@smart-webcomponents-angular/window 22.0.3 → 25.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2020/window/smart.window.mjs +136 -106
- package/fesm2015/smart-webcomponents-angular-window.mjs +135 -105
- package/fesm2015/smart-webcomponents-angular-window.mjs.map +1 -1
- package/fesm2020/smart-webcomponents-angular-window.mjs +135 -105
- package/fesm2020/smart-webcomponents-angular-window.mjs.map +1 -1
- package/index.d.ts +5557 -5320
- package/package.json +1 -1
- package/source/modules/smart.window.js +1 -1
- package/source/smart.button.js +2 -2
- package/source/smart.combobox.js +2 -2
- package/source/smart.dropdownlist.js +2 -2
- package/source/smart.element.js +2 -2
- package/source/smart.listbox.js +2 -2
- package/source/smart.multilinetextbox.js +2 -2
- package/source/smart.progressbar.js +2 -2
- package/source/smart.scrollbar.js +1 -1
- package/source/smart.textbox.js +1 -1
- package/source/smart.window.js +2 -2
- package/styles/smart.base.css +1 -1
- package/styles/smart.window.css +2 -2
- package/window/smart.window.d.ts +110 -105
package/source/smart.listbox.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
|
-
/* Smart UI
|
|
2
|
+
/* Smart UI v25.0.0 (2025-11-26)
|
|
3
3
|
Copyright (c) 2011-2024 jQWidgets.
|
|
4
4
|
License: https://htmlelements.com/license/ */ //
|
|
5
5
|
|
|
6
|
-
Smart("smart-list-item",class extends Smart.ContentElement{static get properties(){return{alternationIndex:{value:-1,type:"int"},color:{value:"",type:"string"},displayMode:{allowedValues:["plain","checkBox","radioButton"],value:"plain",type:"string"},grouped:{value:!1,type:"boolean"},selected:{value:!1,type:"boolean"},value:{value:"",type:"any"},valueName:{value:"",type:"any"},label:{value:"",type:"string"},sanitizeHTML:{value:!1,type:"boolean"},details:{value:"",type:"string"},group:{value:"",type:"string"},hidden:{value:!1,type:"boolean"},readonly:{value:!1,type:"boolean"}}}get hasStyleObserver(){return!1}get enableShadowDOM(){return!1}get _focused(){const e=this;return void 0===e.__focused&&(e.__focused=!1),e.__focused}set _focused(e){const t=this;t.__focused=e,e?(t.setAttribute("focus",""),t.ownerListBox&&t.ownerListBox.ownerElement&&Smart.ComboBox&&t.ownerListBox.ownerElement instanceof Smart.ComboBox&&t.ownerListBox.ownerElement.$.input.setAttribute("aria-activedescendant",t.id)):t.removeAttribute("focus")}template(){return'<div id="container">\n <span id=\'itemInput\' class=\'smart-input smart-hidden\'></span>\n <span class="smart-overlay" id="overlay"></span>\n <div id="itemContainer" class="smart-list-item-label-element smart-content smart-list-item-container"><span class="smart-content-label" inner-h-t-m-l=\'[[innerHTML]]\' role="presentation"><content></content></span><span inner-h-t-m-l=\'[[details]]\' id="details" class="smart-content-details"></span></div>\n </div>'}appendChild(e){const t=this;if(!t.isCompleted||e.classList&&e.classList.contains("smart-ripple")){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.appendChild.apply(t,e.concat(Array.prototype.slice.call(arguments)))}window.smartBlazor?t.$.itemContainer.appendChild(e):(t.$.itemContainer.innerHTML="",e instanceof HTMLElement&&t.$.itemContainer.appendChild(e))}insertBefore(e,t){const i=this;if(!i.isCompleted){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.insertBefore.apply(i,e.concat(Array.prototype.slice.call(arguments)))}t.parentNode.insertBefore(e,t)}removeChild(e){const t=this;if(!t.isCompleted||e.classList.contains("smart-ripple")){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.removeChild.apply(t,e.concat(Array.prototype.slice.call(arguments)))}e instanceof HTMLElement&&t.$.itemContainer.removeChild(e)}attached(){const e=this;super.attached(),e.ownerListBox=e.getListBox(),e.ownerListBox&&(e.ownerListBox.onClick&&(e.onpointerdown=t=>{e.ownerListBox.onClick(t)}),e.ownerListBox.onDoubleClick&&(e.ondblclick=t=>{e.ownerListBox.onDoubleClick(t)}))}static get listeners(){return{mouseenter:"_itemOnMouseEnter",mouseleave:"_itemOnMouseLeave"}}ready(){super.ready();const e=this;if(e.setAttribute("role","option"),""!==e.label){let t=e.label;t&&"string"==typeof t&&e.sanitizeHTML&&(t=t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/'/g,"'").replace(/"/g,""")),e.innerHTML=t}else""!==e.innerHTML&&(e.label=e.innerHTML);e._setDisplayMode(e.displayMode),e._setItemColor(),e.$.container.noRipple=!0;const t=e.closest("smart-list-box");if(t&&t.isRendered){if(cancelAnimationFrame(Smart.ListBox.processTimer),t._inLazyInit||t._isUpdating)return;Smart.ListBox.processTimer=requestAnimationFrame((()=>{t._lazyInitItems()}))}}propertyChangedHandler(e,t,i){const r=this;if(super.propertyChangedHandler(e,t,i),"hidden"===e)i?r.$.addClass("smart-hidden"):r.$.removeClass("smart-hidden");else if("color"===e)r._setItemColor();else if("displayMode"===e)r._setDisplayMode(i);else if("label"===e||"value"===e){const t=r.context;r.context=document,"label"===e&&(r.innerHTML=i);const o=r.getListBox();o&&(o._applyTemplate(r),o.onItemUpdated(r)),r.context=t}else if("details"===e){const e=r.context;r.context=document,r.$.details.innerHTML=i;const t=r.getListBox();t&&t.onItemUpdated(r),r.context=e}else if("innerHTML"===e){const e=r.getListBox();e&&e.onItemUpdated(r)}else if("selected"===e)if(i)r.setAttribute("aria-selected",!0);else{const e=r.getListBox();r.readonly||r.disabled||!e||-1===["oneOrManyExtended","zeroOrMany","oneOrMany","checkBox"].indexOf(e.selectionMode)?r.removeAttribute("aria-selected"):r.setAttribute("aria-selected",!1)}}getListBox(){const e=this;if(!Smart.ListBox)return e.getRootNode().host;let t=e.parentNode;for(;t instanceof Smart.ListBox==0&&null!==t;)t=t.parentNode;return!t&&Smart.EnableShadowDOM?e.getRootNode().host:t}_itemOnMouseEnter(){const e=this;!e.disabled&&e.ownerListBox&&(Smart.ListBox.DragDrop.Dragging&&e.ownerListBox.allowDrop&&(Smart.ListBox.DragDrop.DropDetails={item:e,position:"bottom"}),e.ownerListBox.$.verticalScrollBar.thumbCapture||e.ownerListBox.$.horizontalScrollBar.thumbCapture||e.setAttribute("hover",""))}_itemOnMouseMove(e){const t=this;if(t.ownerListBox&&Smart.ListBox.DragDrop.Dragging&&t.ownerListBox.allowDrop&&!Smart.Utilities.Core.isMobile){const i=[].slice.call(t.ownerListBox.getElementsByClassName("smart-list-item-bottom-line-feedback"));for(let e=0;e<i.length;e++)i[e].$.removeClass("smart-list-item-line-feedback"),i[e].$.removeClass("smart-list-item-bottom-line-feedback");if(Smart.ListBox.DragDrop.DropDetails={item:t,position:"top"},!t.ownerListBox._areCSSVarsSupported){if(t.ownerListBox._indexOf(t)===t.ownerListBox._items.length-1||t.parentNode.lastElementChild===t){const i=t.getBoundingClientRect();e.pageY-window.pageYOffset>i.top+i.height/2-1&&(Smart.ListBox.DragDrop.DropDetails={item:t,position:"bottom"})}return}if(t.$.removeClass("smart-list-item-line-feedback"),t.$.removeClass("smart-list-item-bottom-line-feedback"),t.ownerListBox.sorted&&t.ownerListBox.autoSort)return;const r=t.ownerListBox._items.filter((e=>!e.hidden));if(r.indexOf(t)===r.length-1||t.parentNode.lastElementChild===t){const i=t.getBoundingClientRect();e.pageY-window.pageYOffset>i.top+i.height/2-1?(t.$.addClass("smart-list-item-bottom-line-feedback"),Smart.ListBox.DragDrop.DropDetails={item:t,position:"bottom"}):arguments[1]||t.$.addClass("smart-list-item-line-feedback")}else arguments[1]||t.$.addClass("smart-list-item-line-feedback")}}_itemOnMouseLeave(){const e=this;e.ownerListBox&&(Smart.ListBox.DragDrop.Dragging&&(e.$.removeClass("smart-list-item-line-feedback"),e.$.removeClass("smart-list-item-bottom-line-feedback")),e.removeAttribute("hover"))}_setDisplayMode(e){const t=this,i=t.getListBox();if(i){const r="checkBox"===i.selectionMode||"radioButton"===i.selectionMode?i.selectionMode:"plain";t.displayMode=e=r}"plain"!==e?t.$itemInput.removeClass("smart-hidden"):t.$itemInput.addClass("smart-hidden")}_setItemColor(){const e=this,t=e.querySelector(".smart-content-label"),i=/(^#[0-9A-F]{3}$)|(^#[0-9A-F]{6}$)|(^#[0-9A-F]{8}$)/i.test(e.color)?e.color:"";t.style.backgroundColor=i,t.style.color=e._getContrastColor(i)}_getContrastColor(e){if(!e)return"";let t=(i=e.slice(1,3),r=e.slice(3,5),o=e.slice(5,7),[parseInt(i,16),parseInt(r,16),parseInt(o,16)]);var i,r,o;return parseFloat(((.299*t[0]+.61*t[1]+.114*t[2])/255).toFixed(2))>.65?"#000000":"#FFFFFF"}}),Smart("smart-list-items-group",class extends Smart.ContentElement{static get properties(){return{label:{value:"",type:"string"}}}get enableShadowDOM(){return!1}template(){return'<div id="container" role="presentation">\n <span id="itemsLabel" class="smart-list-items-group-label">[[label]]</span>\n <div id="listItemsGroupContainer" inner-h-t-m-l=\'[[innerHTML]]\' class="smart-list-items-group-container" role="presentation">\n <content></content>\n </div>\n </div>'}appendChild(e){const t=this;if(!t.isCompleted){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.appendChild.apply(t,e.concat(Array.prototype.slice.call(arguments)))}e instanceof HTMLElement&&t.$.listItemsGroupContainer.appendChild(e)}removeChild(e){const t=this;if(!t.isCompleted){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.removeChild.apply(t,e.concat(Array.prototype.slice.call(arguments)))}e instanceof HTMLElement&&t.$.listItemsGroupContainer.removeChild(e)}getListBox(){let e=this.parentNode;for(;e instanceof Smart.ListBox==0&&null!==e;)e=e.parentNode;return e}attached(){const e=this;super.attached(),e.ownerListBox||(e.ownerListBox=e.getListBox()),e.setAttribute("role","group"),e.$.itemsLabel.id||(e.$.itemsLabel.id=e.id+"Label"),e.setAttribute("aria-labelledby",e.$.itemsLabel.id)}}),Smart("smart-list-box",class extends Smart.ScrollViewer{static get properties(){return{allowDrag:{value:!1,type:"boolean"},allowDrop:{value:!1,type:"boolean"},alternationStart:{value:0,type:"int"},alternationEnd:{value:0,type:"int"},alternationCount:{value:0,type:"int"},autoSort:{value:!0,type:"boolean"},dataSource:{value:null,type:"any?",reflectToAttribute:!1},dragFeedbackFormatFunction:{value:null,type:"function?"},dragOffset:{value:[10,10],type:"array"},displayLoadingIndicator:{value:!1,type:"boolean"},displayMember:{value:"",type:"string"},shadowDomMode:{allowedValues:["light","shadow"],value:"shadow",type:"string"},dropAction:{value:"move",type:"string",allowedValues:["copy","move","none"]},editable:{value:!1,type:"boolean"},filterable:{value:!1,type:"boolean"},filterCallback:{value:null,type:"function?"},filterMode:{value:"containsIgnoreCase",allowedValues:["contains","containsIgnoreCase","doesNotContain","doesNotContainIgnoreCase","equals","equalsIgnoreCase","startsWith","startsWithIgnoreCase","endsWith","endsWithIgnoreCase","custom"],type:"string"},filterInputPlaceholder:{value:"",type:"string"},grouped:{value:!1,type:"boolean"},groupMember:{value:"",type:"string"},itemTemplate:{value:null,type:"any"},itemHeight:{value:null,type:"number?"},incrementalSearchDelay:{value:700,type:"number?"},incrementalSearchMode:{value:"startsWithIgnoreCase",allowedValues:["contains","containsIgnoreCase","doesNotContain","doesNotContainIgnoreCase","equals","equalsIgnoreCase","startsWith","startsWithIgnoreCase","endsWith","endsWithIgnoreCase"],type:"string"},itemMeasureMode:{value:"auto",allowedValues:["auto","precise"],type:"string"},loadingIndicatorPlaceholder:{value:"Loading...",type:"string"},loadingIndicatorPosition:{value:"center",allowedValues:["bottom","center","top"],type:"string"},messages:{extend:!0,value:{en:{overridingProperties:'{{elementType}}: Overriding properties {{property1}} and {{property2}} applied. The "{{property1}}" property is used by default.',invalidIndex:'{{elementType}}: "{{method}}" method accepts an index of type number or an Array of numbers.',indexOutOfBound:'{{elementType}}: Out of bound index/indexes in "{{method}}" method.',invalidItem:'{{elementType}}: "{{method}}" method accepts an object or an array of objects as it\'s second parameter.',invalidSettings:'{{elementType}}: "{{method}}" method accepts a string or an object as it\'s second parameter.'}},type:"object"},name:{value:"",type:"string"},placeholder:{value:"No Items",type:"string"},selectedIndexes:{value:[],type:"array"},selectedValues:{value:[],type:"array"},selectionMode:{value:"oneOrManyExtended",allowedValues:["none","oneOrManyExtended","zeroOrMany","oneOrMany","zeroOrOne","zeroAndOne","one","checkBox","radioButton"],type:"string"},selectionChangeAction:{value:"release",allowedValues:["press","release"],type:"string"},sorted:{value:!1,type:"boolean"},sortDirection:{value:"asc",type:"string"},topVisibleIndex:{value:-1,type:"int"},type:{value:"list",type:"string",defaultReflectToAttribute:!0,readonly:!0},valueMember:{value:"",type:"string"},virtualized:{value:!1,type:"boolean"},onClick:{value:null,type:"any",reflectToAttribute:!1},onDoubleClick:{value:null,type:"any",reflectToAttribute:!1}}}static get requires(){return{"Smart.ScrollBar":"smart.scrollbar.js"}}static get styleUrls(){return["smart.listbox.css","smart.dropdown.css","smart.scrollbar.css"]}static get listeners(){return{focus:"_focusHandler",blur:"_blurHandler","container.wheel":"_mouseWheelHandler","editInput.change":"_editInputEventHandler","editInput.blur":"_editInputEventHandler","editInput.keydown":"_editInputEventHandler","horizontalScrollBar.change":"_horizontalScrollbarHandler","itemsInnerContainer.down":"_downHandler","itemsInnerContainer.dblclick":"_dblclickEventHandler","itemsInnerContainer.move":"_itemsContainerMoveHandler","itemsContainer.mouseleave":"_mouseLeaveHandler","itemsInnerContainer.touchmove":"_touchmoveHandler","itemsInnerContainer.touchstart":"_touchstartHandler","document.move":"_moveHandler",keydown:"_keyDownHandler",keyup:"_keyUpHandler",resize:"_resizeHandler",selectstart:"_selectStartHandler",styleChanged:"_styleChangedHandler",swipeleft:"_swipeLeftHandler",swiperight:"_swipeRightHandler",touchmove:"_overriddenHandler",touchstart:"_overriddenHandler","verticalScrollBar.change":"_verticalScrollbarHandler"}}template(){return'<div id="container" class="smart-container" role="presentation">\n <div class="smart-list-box-filter-input-container smart-hidden" id="filterInputContainer" role="presentation"><input id="filterInput" disabled="[[disabled]]" placeholder=\'[[filterInputPlaceholder]]\' role="searchbox" aria-label="[[filterInputPlaceholder]]"></div>\n <div id="itemsContainer" class="smart-list-items-container" role="presentation">\n <div id="placeholder" class="smart-placeholder" role="presentation" aria-hidden="true">[[placeholder]]</div>\n <div id="itemsInnerContainer" inner-h-t-m-l=\'[[innerHTML]]\' class="smart-list-items-inner-container" role="presentation">\n <content></content>\n </div>\n <input type="text" id="editInput" class= "smart-hidden"/>\n </div>\n <smart-scroll-bar wait theme="[[theme]]" right-to-left="[[rightToLeft]]" id="verticalScrollBar" disabled="[[disabled]]" orientation="vertical"></smart-scroll-bar>\n <smart-scroll-bar wait theme="[[theme]]" right-to-left="[[rightToLeft]]" id="horizontalScrollBar" disabled="[[disabled]]"></smart-scroll-bar>\n <div id="loadingIndicatorContainer" class="smart-loader-container" role="presentation">\n <span id="loadingIndicator" class="smart-loader" role="img" aria-label="[[loadingIndicatorPlaceholder]]"></span>\n <span id="loadingIndicatorPlaceHolder" class="smart-loader-label smart-hidden">[[loadingIndicatorPlaceholder]]</span>\n </div>\n <input id="hiddenInput" type="hidden" name="[[name]]">\n </div>'}get value(){const e=this;return e.isRendered&&e._selectedItems.length>0?e._selectedItems.map((e=>({label:e.label,value:e.value}))):null}set value(e){const t=this;if(Array.isArray(e)){const i=t.context;t.context=t,t._isUpdating++,t.selectedValues=[],t.clearSelection();for(let i=0;i<e.length;i++){const r=e[i],o=t.getItem(r);o&&("oneOrManyExtended"===t.selectionMode?t._select(o):t.select(o))}return t.context=i,void t._isUpdating--}const i=t.getItem(e);i&&t.select(i)}get _selectedItems(){const e=this,t=[];if(e.isRendered)for(let i=0;i<e._items.length;i++){const r=e._items[i];r.selected&&t.push(r)}return t}_mouseLeaveHandler(){const e=[].slice.call(this.getElementsByClassName("smart-list-item-bottom-line-feedback"));for(let t=0;t<e.length;t++)e[t].$.removeClass("smart-list-item-line-feedback"),e[t].$.removeClass("smart-list-item-bottom-line-feedback")}_downHandler(e){const t=this;if(t.disabled||t.displayLoadingIndicator||t.readonly)return;let i=e.originalEvent.target,r=null;if(!(i instanceof Smart.ListItem)||i.disabled||i.hidden||i instanceof Smart.ListItemsGroup)for(;i.parentElement;){if(i instanceof Smart.ListItem&&!i.disabled&&!i.hidden&&!(i instanceof Smart.ListItemsGroup)){r=i.dataItem;break}i=i.parentElement}else r=i.dataItem;Smart.ListBox.DragDrop.StartTime=new Date,Smart.ListBox.DragDrop.StartPosition={left:e.pageX,top:e.pageY},r&&(e.stopPropagation(),t.hasRippleAnimation&&(r.readonly||r.disabled||Smart.Utilities.Animation.Ripple.animate(i.$.overlay,e.pageX,e.pageY)),Smart.Utilities.Core.isMobile||"press"!==t.selectionChangeAction||(t._focus(r),t.select(r)),!Smart.ListBox.DragDrop.Feedback&&t.allowDrag&&(Smart.ListBox.DragDrop.DraggedFrom=t,Smart.ListBox.DragDrop.Feedback=document.createElement("span"),t.rightToLeft?Smart.ListBox.DragDrop.Feedback.setAttribute("right-to-left",!0):Smart.ListBox.DragDrop.Feedback.removeAttribute("right-to-left"),t.dragFeedbackFormatFunction?Smart.ListBox.DragDrop.Feedback.innerHTML=t.dragFeedbackFormatFunction(r):Smart.ListBox.DragDrop.Feedback.appendChild(r.offsetHeight?r.cloneNode(!0):t._createItem(r)),Smart.ListBox.DragDrop.Item=r,Smart.Utilities.Extend(Smart.ListBox.DragDrop.Feedback).addClass("smart-popup smart-list-item smart-list-item-feedback")))}_dblclickEventHandler(e){const t=this;if(!t.editable)return;const i=e.target.closest("smart-list-item");i instanceof Smart.ListItem&&!i.disabled&&!i.readonly?(t.$.editInput.dir=t.rightToLeft?"rtl":"ltr",t.$.editInput.style.width=t.$.itemsInnerContainer.offsetWidth+"px",t.$.editInput.owner=i,t.$.editInput.value=i.label,t.$.editInput.style.height=i.offsetHeight+"px",t.$.editInput.style.top=i.offsetTop+t.$.itemsInnerContainer.offsetTop+"px",t.$.editInput.setAttribute("aria-label","Edit item "+i.label),t.$editInput.hasClass("smart-hidden")&&t.$editInput.removeClass("smart-hidden"),t.$.editInput.focus({preventScroll:!0})):t.$editInput.addClass("smart-hidden")}_editInputEventHandler(e){const t=this;if("blur"===e.type||"keydown"===e.type&&"Escape"===e.key)return t.$editInput.hasClass("smart-hidden")||t.$editInput.addClass("smart-hidden"),void t.focus();if("keydown"===e.type||t.$editInput.hasClass("smart-hidden"))return;const i=e.target;if(e.stopPropagation(),i.owner.label!==i.value&&(i.owner.label=i.value,t.itemTemplate&&t._applyTemplate(i.owner),t.dataSource)){const e=i.owner.dataIndex,r=t.dataSource[e];r&&(t.displayMember?r[t.displayMember]=i.value:r.label=i.value)}t.$editInput.addClass("smart-hidden"),t.$.fireEvent("itemLabelChange",{selected:i.owner.selected,disabled:i.owner.disabled,index:t._indexOf(i.owner),label:i.owner.label,value:i.owner.value})}_pointerUpHandler(e){const t=this;let i=e.originalEvent,r=i.target;(t.shadowRoot||t.isInShadowDOM)&&(r=i.originalEvent?i.originalEvent.composedPath()[0]:i.composedPath()[0]);const o=e=>{const i=e.ownerListBox;i.disabled||i!==t||i.displayLoadingIndicator||"none"===i.selectionMode||e.grouped||e.readonly||(i._focus(e),i.select(e),Smart.ListBox.DragDrop.StartPosition=null,t.$.fireEvent("itemClick",{selected:r.selected,disabled:r.disabled,index:t._indexOf(r),label:r.label,value:r.value}))};if(!(i.target instanceof Smart.ListItem)||i.target.disabled||i.target instanceof Smart.ListItemsGroup){for(;r&&r.parentElement;){if(r instanceof Smart.ListItem&&!r.disabled&&!(r instanceof Smart.ListItemsGroup))return void o(r.dataItem);r=r.parentElement}if(this.shadowRoot&&"shadow"===this.shadowDomMode){const e=i.composedPath();for(let t=0;t<e.length;t++){const i=e[t];i instanceof Smart.ListItem&&!i.disabled&&o(i.dataItem)}}}else o(r.dataItem)}_upHandler(e){const t=this;if(super._upHandler(),!t.disabled&&!t.readonly&&Smart.ListBox.DragDrop.StartPosition){if(Smart.Utilities.Core.isMobile&&!Smart.ListBox.DragDrop.Dragging){const i=Math.abs(e.pageX-Smart.ListBox.DragDrop.StartPosition.left),r=Math.abs(e.pageY-Smart.ListBox.DragDrop.StartPosition.top);let o=i>=0&&i<=3&&r>=0&&r<=3;if(Smart.Utilities.Core.isMobile&&new Date-Smart.ListBox.DragDrop.StartTime>=300&&(o=!1,Smart.ListBox.DragDrop.StartTime=null),o){const i=e.originalEvent.target.closest("smart-list-box");i?i._pointerUpHandler(e):t._pointerUpHandler(e),Smart.ListBox.DragDrop.StartPosition=null}else{let t=e.originalEvent.target;if(!(e.target instanceof Smart.ListItem)||t.readonly||e.target.disabled||e.target instanceof Smart.ListItemsGroup)for(;t.parentElement;){if(t instanceof Smart.ListItem&&!t.readonly&&!t.disabled&&!(t instanceof Smart.ListItemsGroup)){e.stopPropagation();break}t=t.parentElement}else e.stopPropagation()}}else if(!Smart.Utilities.Core.isMobile&&!Smart.ListBox.DragDrop.Dragging&&"release"===t.selectionChangeAction){const i=(t.shadowRoot||t.isInShadowDOM?e.originalEvent.composedPath()[0]:e.originalEvent.target).closest("smart-list-box");i&&(i.upTimer&&clearTimeout(i.upTimer),t.isInShadowDOM?i?i._pointerUpHandler(e):t._pointerUpHandler(e):i.upTimer=setTimeout((()=>{i?i._pointerUpHandler(e):t._pointerUpHandler(e)})))}if(Smart.ListBox.DragDrop.Feedback){let i;if(Smart.ListBox.DragDrop.Feedback.parentNode&&Smart.ListBox.DragDrop.Feedback.parentNode.removeChild(Smart.ListBox.DragDrop.Feedback),Smart.ListBox.DragDrop.Feedback=null,Smart.Utilities.Core.isMobile&&Smart.ListBox.DragDrop.Dragging)for(let t=0;t<Smart.ListBox.DragDrop.ListBoxes.length;t++){const r=Smart.ListBox.DragDrop.ListBoxes[t],o=r.getBoundingClientRect();if(r.allowDrop&&!r.closest(".smart-visibility-hidden")&&o.left<=e.clientX&&e.clientX<=o.left+o.width&&o.top<=e.clientY&&e.clientY<=o.top+o.height){i=r;const t=r._items.filter((e=>!e.hidden));for(let i=0;i<t.length;i++){const s=t[i],l=s.getBoundingClientRect();if((t.indexOf(s)===t.length-1||s.parentNode.lastElementChild===s)&&e.clientY>=o.top+s.offsetTop-r.scrollTop+l.height/2&&e.clientY<=o.top-r.scrollTop+s.offsetTop+l.height){Smart.ListBox.DragDrop.DropDetails={item:s,position:"bottom"};break}if(e.clientY>=o.top+s.offsetTop-r.scrollTop&&e.clientY<=o.top+s.offsetTop+l.height-r.scrollTop){Smart.ListBox.DragDrop.DropDetails={item:s,position:"top"};break}}}}if(Smart.ListBox.DragDrop.Dragging){if(Smart.ListBox.DragDrop.DropDetails){let r=Smart.ListBox.DragDrop.DropDetails.item,o=Smart.ListBox.DragDrop.Item;const s=o.ownerListBox;let l=e.originalEvent.target;if(t.isInShadowDOM&&(l=e.originalEvent?e.originalEvent.composedPath()[0]:e.composedPath()[0]),i=!i&&l.closest?l.closest("smart-list-box"):i,document.body.classList.remove("smart-dragging"),r.$.removeClass("smart-list-item-line-feedback"),r.$.removeClass("smart-list-item-bottom-line-feedback"),i&&r.ownerListBox!==i&&i.items.length>0&&(r=i.items[i.items.length-1]),Smart.ListBox.DragDrop.Item===r||i!==r.ownerListBox&&!Smart.Utilities.Core.isMobile)i&&0===i._items.length&&"none"!==i.dropAction&&("move"===i.dropAction?Smart.ListBox.DragDrop.Item.ownerListBox.removeChild(Smart.ListBox.DragDrop.Item):"copy"===i.dropAction&&(o=o.cloneNode(!0)),i.appendChild(o));else if("none"!==o.ownerListBox.dropAction){r.ownerListBox!==o.ownerListBox&&"move"===o.ownerListBox.dropAction&&Smart.ListBox.DragDrop.Item.ownerListBox.removeChild(Smart.ListBox.DragDrop.Item),"copy"===o.ownerListBox.dropAction&&(o=o.cloneNode(!0)),Smart.ListBox.DragDrop.Item.group=r.group;const e=r.ownerListBox;"checkBox"!==e.selectionMode&&"radioButton"!==e.selectionMode&&e.clearSelection(),"top"===Smart.ListBox.DragDrop.DropDetails.position?e.insertBefore(o,r):r.parentNode.lastElementChild===r?e.appendChild(o):e.appendChild(o,r),e.ensureVisible(o),"checkBox"===e.selectionMode||"radioButton"===e.selectionMode?(e._focus(o),e._refreshSelection()):(e.clearSelection(),e.select(o))}o.selected&&i!==s&&s._refreshSelection();const n=Smart.ListBox.DragDrop.Item,a=n.ownerListBox;n.displayMode="checkBox"===a.selectionMode||"radioButton"===a.selectionMode?a.selectionMode:"plain",a.$.fireEvent("dragEnd",{item:n,target:r,data:Smart.ListBox.DragDrop,previousContainer:s,container:i,originalEvent:e}),a._focus(n)}else{const t=Smart.ListBox.DragDrop.Item,i=t.ownerListBox;t.displayMode="checkBox"===i.selectionMode||"radioButton"===i.selectionMode?i.selectionMode:"plain",document.body.classList.remove("smart-dragging"),i.$.fireEvent("dragEnd",{item:t,target:null,data:Smart.ListBox.DragDrop,previousContainer:i,container:i,originalEvent:e}),i._focus(t)}e.preventDefault()}delete Smart.ListBox.DragDrop.DraggedFrom,Smart.ListBox.DragDrop.Dragging=!1,Smart.ListBox.DragDrop.Item=null,Smart.ListBox.DragDrop.DropDetails=null}for(let e=0;e<Smart.ListBox.DragDrop.ListBoxes.length;e++){const t=Smart.ListBox.DragDrop.ListBoxes[e];t._dragInterval&&clearInterval(t._dragInterval)}}}_itemsContainerMoveHandler(e){const t=this;if(Smart.ListBox.DragDrop.Dragging)return t._applyItemFeedback(e),t._moveHandler(e),e.originalEvent.preventDefault(),e.originalEvent.stopPropagation(),!1}_touchmoveHandler(e){if(Smart.ListBox.DragDrop.Dragging&&e.cancelable)return e.preventDefault(),void e.stopPropagation();super._touchmoveHandler(e)}_applyItemFeedback(e){const t=this,i=e.originalEvent.target,r=i.closest?i.closest("smart-list-item"):i;Smart.Utilities.Core.isMobile?Smart.ListBox.DragDrop.DropDetails={item:Smart.ListBox.DragDrop.Item,position:"bottom"}:0!==t.items.length&&(r?r._itemOnMouseMove(e):t.items[t.items.length-1]._itemOnMouseMove(e,!0))}_moveHandler(e){const t=this;if(!Smart.ListBox.DragDrop.Feedback||Smart.ListBox.DragDrop.DraggedFrom!==t)return;const i=t.dragOffset;if(Smart.ListBox.DragDrop.Dragging){Smart.ListBox.DragDrop.Feedback.style.left=i[0]+e.pageX+"px",Smart.ListBox.DragDrop.Feedback.style.top=i[1]+e.pageY+"px",t.$.fireEvent("dragging",{item:Smart.ListBox.DragDrop.Item,data:Smart.ListBox.DragDrop,originalEvent:e.originalEvent});for(let t=0;t<Smart.ListBox.DragDrop.ListBoxes.length;t++){const i=Smart.ListBox.DragDrop.ListBoxes[t];i._dragInterval&&clearInterval(i._dragInterval),i._dragInterval=setInterval((function(){const t=i.getBoundingClientRect();t.left<=e.clientX&&t.left+t.width>=e.clientX&&(e.clientY>=t.top&&e.clientY<=t.top+20?i.scrollTop-=2:e.clientY>=t.top+t.height-20&&e.clientY<=t.top+t.height&&(i.scrollTop+=2))}),1)}return e.preventDefault(),e.stopPropagation(),e.originalEvent.preventDefault(),e.originalEvent.stopPropagation(),!1}{const r=Math.abs(e.pageX-Smart.ListBox.DragDrop.StartPosition.left),o=Math.abs(e.pageY-Smart.ListBox.DragDrop.StartPosition.top),s=new Date-Smart.ListBox.DragDrop.StartTime;let l=r>=5&&r<=15||o>=5&&o<=15;if(Smart.Utilities.Core.isMobile&&(s<300||s>1e3)&&(l=!1),l){Smart.ListBox.DragDrop.Dragging=!0,Smart.ListBox.DragDrop.Feedback.style.left=i[0]+e.pageX+"px",Smart.ListBox.DragDrop.Feedback.style.top=i[1]+e.pageY+"px",t.getShadowRootOrBody().appendChild(Smart.ListBox.DragDrop.Feedback),e.preventDefault(),e.stopPropagation(),e.originalEvent.preventDefault(),e.originalEvent.stopPropagation();const r=Smart.ListBox.DragDrop.Item,o=r.ownerListBox;o.$.fireEvent("dragStart",{item:r,data:Smart.ListBox.DragDrop,container:o,previousContainer:o,originalEvent:e.originalEvent}),document.body.classList.add("smart-dragging")}}}_focusHandler(){this._focused=!0,this.setAttribute("focus","")}_blurHandler(){this._focused=!1,this.removeAttribute("focus")}appendChild(e){const t=this;if(!t.isCompleted){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.appendChild.apply(t,e.concat(Array.prototype.slice.call(arguments)))}t.isVirtualized?(t._items.indexOf(e)>-1&&t._items.splice(t._items.indexOf(e),1),t._items.push(e)):(e.dataItem=e,t.shadowRoot&&"light"===t.shadowDomMode?t.appendChild(e):t.$.itemsInnerContainer.appendChild(e),t._items.indexOf(e)>-1&&t._items.splice(t._items.indexOf(e),1),t._items.push(e)),t._isUpdating||(t._refreshItems(),t._refreshSelection())}insertBefore(e,t){const i=this;if(!i.isCompleted){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.insertBefore.apply(i,e.concat(Array.prototype.slice.call(arguments)))}i.isVirtualized?(i._items.indexOf(e)>-1&&i._items.splice(i._items.indexOf(e),1),i._items.splice(i._indexOf(t),0,e)):(e.dataItem=e,t.parentNode.insertBefore(e,t),i._items.indexOf(e)>-1&&i._items.splice(i._items.indexOf(e),1),i._items.splice(i._indexOf(t),0,e)),i._refreshItems(),i._refreshSelection()}removeChild(e){const t=this;if(!t.isCompleted){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.removeChild.apply(t,e.concat(Array.prototype.slice.call(arguments)))}if(t.isVirtualized)t._items.splice(t._indexOf(e),1);else if(e.parentNode){const i=t.selectedIndexes.slice(0),r=t.selectedValues.slice(0),o=i.indexOf(e.dataIndex);e.parentNode.removeChild(e),o>-1&&(i.splice(o,1),r.splice(o,1),t.selectedIndexes=i,t.selectedValues=r)}t._refreshItems()}propertyChangedHandler(e,t,i){if("dataSource"===e&&(!i||i&&Array.isArray(i)&&0===i.length))return void this.clearItems();super.propertyChangedHandler(e,t,i);const r=this;switch(e){case"innerHTML":r.clearSelection(),r._dataBind(),r.innerHTML=r.content=Smart.Utilities.Core.html(r.$.content);break;case"dataSource":case"valueMember":case"groupMember":case"displayMember":r.clearSelection(),r._dataBind(),r._applyDefaultSelection();break;case"disabled":case"unfocusable":r._setFocusable();break;case"displayLoadingIndicator":r._setLoadingIndicatorVisibility();break;case"filterable":r._refreshFilter(),r._refreshLayout();break;case"grouped":if(i?r._group():r._ungroup(),"radioButton"===r.selectionMode){if(r.selectedValues.length>0){const e=r.selectedValues;r.clearSelection(),r.select(e[0])}}else r._refreshSelection();r._refreshLayout();break;case"itemTemplate":{if(null===i||""===i)return r._items.map((e=>e.innerHTML=e.label)),delete r._bindingDetails,void r._refreshLayout();const e=r.querySelectorAll("smart-list-item"),t=function(){r._handleItemTemplate(i)&&(r._items.map((e=>r._applyTemplate(e))),r._refreshLayout()),r.ownerElement&&r.ownerElement._setDropDownSize&&r.ownerElement._setDropDownSize(),r.$.fireEvent("bindingComplete")};0===e.length?t():r._ensureItemsReady(e,t);break}case"selectedIndexes":case"selectedValues":{let o=r.selectedIndexes.slice(0),s=r.selectedValues.slice(0);if(!r._items||0===r._items.length)return r.selectedIndexes=[],r.selectedValues=[],void(r.$.hiddenInput.value=r.selectedValues.toString());if(r._propertyChanging=!0,"selectedIndexes"===e){o=t.slice(0),r.clearSelection();for(let e=0;e<i.length;e++){const t=i[e],o=r._items[t];o&&("oneOrManyExtended"===r.selectionMode||"oneOrMany"===r.selectionMode?(r.selectedIndexes.length>0&&0===e&&r.clearSelection(),r._select(o)):r.select(o))}}else{s=t.slice(0),r.selectedValues=[],r.clearSelection();for(let e=0;e<i.length;e++){const t=i[e],o=r.getItem(t);o&&("oneOrManyExtended"===r.selectionMode?r._select(o):r.select(o))}}if(r.selectedIndexes.length>0&&r._focus(r._items[r.selectedIndexes[0]]),r._propertyChanging=!1,JSON.stringify(s)!==JSON.stringify(r.selectedValues.slice(0))){let e=[],t=[];for(let e=0;e<o.length;e++)r.selectedIndexes.indexOf(o[e])<0&&t.push(r._items[o[e]]);for(let t=0;t<r.selectedIndexes.length;t++)o.indexOf(r.selectedIndexes[t])<0&&e.push(r._items[r.selectedIndexes[t]]);let i={addedItems:e,removedItems:t};if(r.selectedIndexes.length>0){const e=r._items[r.selectedIndexes[r.selectedIndexes.length-1]];void 0!==e&&(i.selected=e.selected,i.disabled=e.disabled,i.index=r._indexOf(e),i.label=e.label,i.value=e.value)}else i.selected=!1,i.disabled=!1,i.index=-1,i.label="",i.value="";r.$.fireEvent("change",i),r._updateTargetValue()}break}case"selectionMode":{const e="checkBox"===r.selectionMode||"radioButton"===r.selectionMode?r.selectionMode:"plain",o=r.selectedIndexes.slice(0),s=r.selectedValues.slice(0);r._propertyChanging=!0;const l=r.selectedValues;r.setAttribute("aria-multiselectable",-1!==["oneOrManyExtended","zeroOrMany","oneOrMany","checkBox","radioButton"].indexOf(i)),r.selectedValues=[],r.clearSelection();for(let e=0;e<l.length;e++){const t=l[e],i=r.getItem(t);i&&("oneOrManyExtended"===r.selectionMode?r._select(i):r.select(i))}if(r._items.forEach((t=>t.displayMode=e)),r._recycle(),r._propertyChanging=!1,JSON.stringify(s)!==JSON.stringify(r.selectedValues.slice(0))){let e=[],t=[];for(let e=0;e<o.length;e++)r.selectedIndexes.indexOf(o[e])<0&&t.push(r._items[o[e]]);for(let t=0;t<r.selectedIndexes.length;t++)o.indexOf(r.selectedIndexes[t])<0&&e.push(r._items[r.selectedIndexes[t]]);let i={addedItems:e,removedItems:t};if(o.length>0){const e=r._items[o[o.length-1]];e&&(i.selected=e.selected,i.disabled=e.disabled,i.index=r._indexOf(e),i.label=e.label,i.value=e.value)}r.$.fireEvent("change",i),r._updateTargetValue()}r._applyAriaSelected(),"checkBox"!==i&&"radioButton"!==i&&"checkBox"!==t&&"radioButton"!==t||r._refreshLayout();break}case"topVisibleIndex":r._setTopVisibleIndex(i);break;case"autoSort":r._canSort=i;break;case"alternationStart":case"alternationEnd":case"alternationCount":r._refreshItems(),r._refreshLayout();break;case"sortDirection":case"sorted":{r._canSort=!0,i?r._sort():r._unsort();const e=r.selectedValues;r.selectedValues=[],r._refreshSelection();for(let t=0;t<e.length;t++){const i=e[t],o=r.getItem(i);o&&("oneOrManyExtended"===r.selectionMode?r._select(o):r.select(o))}r._refreshLayout(),r._canSort=r.autoSort;break}}}_refreshSelection(){const e=this;if(!e._items||0===e._items.length)return;const t=e.selectedValues;e.selectedIndexes=[],e.selectedValues=[];for(let i=0;i<e._items.length;i++){const r=e._items[i];r.selected=!1,t.indexOf(r.value)>-1&&e.select(r)}e._recycle()}clearSelection(){const e=this;if(!e._items||0===e._items.length)return;let t=[];for(let i=0;i<e._items.length;i++)e._items[i].selected&&t.push(e._items[i]);e._items.map((e=>e.selected=!1)),e.selectedValues.slice(0);const i=e.selectedIndexes.slice(0);if(e.selectedIndexes=[],e.selectedValues=[],e.$.hiddenInput.value=e.selectedValues.toString(),e._recycle(),e.context!==e){let r={addedItems:[],removedItems:t};if(i.length>0){const t=e._items[i[i.length-1]];t&&(r.selected=t.selected,r.disabled=t.disabled,r.index=e._indexOf(t),r.label=t.label,r.value=t.value)}e.$.fireEvent("change",r),e._updateTargetValue()}}ensureVisible(e){const t=this;if(e)return!("string"==typeof e&&!(e=t.getItem(e))||(t.isVirtualized||t.$.itemsContainer.scrollTop===t.scrollTop||(t.scrollTop=t.$.itemsContainer.scrollTop),e.top+e.height>=t.scrollTop+t.offsetHeight&&(t.scrollTop=t.scrollTop+e.height,t.isVirtualized||(t.$.itemsContainer.scrollTop=t.scrollTop)),(e.top<=t.scrollTop||e.top>=t.scrollTop+t.$.itemsContainer.offsetHeight)&&(t.scrollTop=e.top,t.isVirtualized||(t.$.itemsContainer.scrollTop=t.scrollTop)),0===t._indexOf(e)||1===t._indexOf(e)&&t._items.length>1&&t._items[0].grouped?(t.scrollTop=0,t.isVirtualized||(t.$.itemsContainer.scrollTop=t.scrollTop)):t._indexOf(e)===t._items.length-1&&(t.scrollTop=t.scrollHeight,t.isVirtualized||(t.$.itemsContainer.scrollTop=t.scrollTop)),0))}get items(){const e=this;if(!window.__karma__&&!window.karma&&e instanceof Element&&e.isRendered&&e.hasAttribute&&e.hasAttribute("smart-blazor")){let t=[];for(let i=0;i<e._items.length;i++){const r=e._items[i];t.push({label:r.label,value:r.value})}return t}return e._filteredItems?e._filteredItems:e._items}getItems(){const e=this,t=e._filteredItems?e._filteredItems:e._items;let i=[];if(t&&t.length>0)for(let e=0;e<t.length;e++){const r=t[e];i.push({label:r.label,value:r.value})}return i}ready(){super.ready();const e=this;if(e.shadowRoot&&"light"===e.shadowDomMode){const t=document.createDocumentFragment();[].slice.call(e.$.itemsInnerContainer.children).map((e=>t.appendChild(e))),e.appendChild(t),e.$.itemsInnerContainer.appendChild(document.createElement("slot"))}e._areCSSVarsSupported=Smart.Utilities.Core.CSSVariablesSupport(),e.isUpdating=0,e._scrollView&&(e._scrollView=new Smart.Utilities.Scroll(e,e.$.horizontalScrollBar,e.$.verticalScrollBar),e._scrollView.hScrollBar.$.addClass("smart-hidden"),e._scrollView.vScrollBar.$.addClass("smart-hidden"));const t=e._scrollView.vScrollBar,i=e._scrollView.hScrollBar;t.hasStyleObserver=!1,i.hasStyleObserver=!1,t.hasResizeObserver=!1,i.hasResizeObserver=!1,t.wait=!1,i.wait=!1,e._setFocusable()}render(){const e=this;e.setAttribute("role","listbox"),e.setAttribute("aria-orientation","vertical"),e.$.verticalScrollBar.setAttribute("aria-controls",e.id),e.$.horizontalScrollBar.setAttribute("aria-controls",e.id),e._keysPressed={},e._incrementalSearchQuery="",e._incrementalSearchItems=[],e._canSort=!0,e._previousEntry="",e._setLoadingIndicatorVisibility(),e._refreshFilter(),e._initializeInnerHTML(),e._dataBind(),e._applyDefaultSelection(),e.enableShadowDOM&&HTMLElement.prototype.appendChild.apply(e,[e.$.hiddenInput]),e.setAttribute("aria-multiselectable",-1!==["oneOrManyExtended","zeroOrMany","oneOrMany","checkBox","radioButton"].indexOf(e.selectionMode)),super.render()}_lazyInitItems(){const e=this;if(e._inLazyInit)return cancelAnimationFrame(Smart.ListBox.processTimer),void delete Smart.ListBox.processTimer;e._inLazyInit=!0,e.dataSource||(e.clearSelection(),e._dataBind(),e._applyDefaultSelection()),cancelAnimationFrame(Smart.ListBox.processTimer),delete Smart.ListBox.processTimer,e._inLazyInit=!1}_applyDefaultSelection(){const e=this;!e._focusedItem&&e._items&&e._items.length>0&&0===e.selectedIndexes.length&&("one"!==e.selectionMode&&"oneOrMany"!==e.selectionMode&&"oneOrManyExtended"!==e.selectionMode||e.select(e._items[0]))}attached(){const e=this;super.attached(),Smart.ListBox.DragDrop||(Smart.ListBox.DragDrop={ListBoxes:[]}),Smart.ListBox.DragDrop.ListBoxes.push(e),e._scrollView||(e._scrollView=new Smart.Utilities.Scroll(e,e.$.horizontalScrollBar,e.$.verticalScrollBar)),e.selectedIndexes.length>0&&e._items&&e.ensureVisible(e._items[e.selectedIndexes[0]])}detached(){const e=this;if(super.detached(),e._scrollView&&(e._scrollView.unlisten(),delete e._scrollView),Smart.ListBox.DragDrop&&Smart.ListBox.DragDrop.ListBoxes){const t=Smart.ListBox.DragDrop.ListBoxes.indexOf(e);Smart.ListBox.DragDrop.ListBoxes.splice(t,1)}}_createItem(e,t,i){const r=this,o="checkBox"===r.selectionMode||"radioButton"===r.selectionMode?r.selectionMode:"plain",s=i?{}:document.createElement("smart-list-item");s.ownerListBox=r,"number"==typeof e&&(e=""+e);const l=function(t,i){return void 0!==e[t]?""+e[t]:e[i]};let n="string"==typeof e?e:l(r.displayMember,"label"),a="string"==typeof e?e:l(r.valueMember,"value"),d=l(r.groupMember,"group");return void 0===n&&(n=void 0!==t?""+t:""),s.label=s.innerHTML=""+n,void 0===a&&(a=void 0!==t?""+t:n),e.color&&(s.color=e.color),s.value=""+a,s.displayMode=o,s.selected=!!e.selected&&e.selected,s.disabled=!!e.disabled&&e.disabled,s.dataItem=s,void 0!==t&&(s.dataIndex=t),r._alternateItem(s),e.title&&(s.title=e.title),d&&(s.group=""+d),s}_alternateItem(e){const t=this,i=t.alternationStart,r=t.alternationEnd>0?t.alternationEnd:1/0;t.alternationCount<=0||(void 0===t._alternationIndexCounter&&(t._alternationIndexCounter=0),e.dataIndex>=i&&e.dataIndex<=r&&(e.alternationIndex=t._alternationIndexCounter++,t._alternationIndexCounter===t.alternationCount&&(t._alternationIndexCounter=0)))}_beginUpdate(){this.isUpdating++}_isUpdating(){return this.isUpdating>0}_endUpdate(){this.isUpdating--}get _scrollHeight(){const e=this;if(0===e._items.length||e._items.filter((e=>!e.hidden)).length<1)return 0;let t=0;if(e.isVirtualized){if(e.__scrollHeight)return e.__scrollHeight;if(0===e._items.length)return 0;e.isUpdating++;const i=e._createItem(e._items[0]);e.$.itemsInnerContainer.appendChild(i);for(let r=0;r<e._items.length;r++){const o=e._items[r];o.hidden?(o.height=0,o.top=t):(e.itemHeight?(e.itemHeight<32&&(e.itemHeight=32),o.height=e.itemHeight):(i.$&&i.$.itemContainer?i.$.itemContainer.firstElementChild.innerHTML=o.label:i.label=o.label,o.height=i.offsetHeight),o.top=t,t+=o.height)}e.$.itemsInnerContainer.removeChild(i),e.__scrollHeight=t-e.$.itemsInnerContainer.offsetHeight,e.filterable,t=e.__scrollHeight,e.isUpdating--}else{for(let i=0;i<e._items.length;i++){const r=e._items[i];r.hidden?(r.height=0,r.top=t):(e.itemHeight?"auto"!==e.itemHeight&&(r.height=e.itemHeight,r.style.height=r.height+"px"):r.height=r.offsetHeight,r.top=r.offsetTop,t+=r.height)}t=e.$.itemsInnerContainer.scrollHeight-e.$.itemsInnerContainer.offsetHeight,e.filterable&&t>0&&(t+=e.$.filterInput.offsetHeight),e.__scrollHeight=t}return t}_initializeRecyclingItems(){const e=this;if(!e.dataSource||e.dataSource&&0===e.dataSource.length||!e.isVirtualized)return;let t=0,i=e.offsetHeight||400;e.$.itemsInnerContainer.innerHTML="",e._recyclingItems=[];const r=function(r){for(let o=0;o<r.length;o++){const s=r[o],l=e._createItem(s);if(e.itemHeight&&"auto"!==e.itemHeight&&(l.style.height=e.itemHeight+"px"),e.$.itemsInnerContainer.appendChild(l),t+=l.offsetHeight,l.dataItem=e._items[o],e._recyclingItems.push(l),t>1.5*i)break}};if("function"==typeof e.dataSource){let e=[];for(let t=0;t<100;t++)e.push("");r(e)}else{r(e.dataSource);let o=0;for(;t<1.5*i&&++o<5;)r(e.dataSource)}}dataBind(){const e=this;e.clearSelection(),e._dataBind(),e._applyDefaultSelection()}_dataBind(){const e=this;if(e._scrollView||(e._scrollView=new Smart.Utilities.Scroll(e,e.$.horizontalScrollBar,e.$.verticalScrollBar)),"function"==typeof e.dataSource){e._items=[],delete e._filteredItems;const t=e.dataSource("",(t=>{e.clearItems(),e.insert(0,t)}));t&&Array.isArray(t)&&(e.clearItems(),e.insert(0,t))}if("string"==typeof e.dataSource&&(e.dataSource=JSON.parse(e.dataSource)),null!==e.dataSource&&Array.isArray(e.dataSource)){e.isUpdating++;const t=t=>{e._items=[],e._groups=[],delete e._filteredItems;const i=e.dataSource;for(let r=0;r<i.length;r++){const o=i[r],s=e._createItem(o,r,!t);e._items[r]=s,t&&t.appendChild(s)}};if(e.isVirtualized)t(),e._initializeRecyclingItems();else{const i=document.createDocumentFragment();e.$.itemsInnerContainer.innerHTML="",t(i),e.$.itemsInnerContainer.appendChild(i)}e.isUpdating--}const t=e.shadowRoot?e.shadowRoot.querySelectorAll("smart-list-item"):e.querySelectorAll("smart-list-item"),i=function(){e.isUpdating++,e.dataSource||(e._initializeHtmlListItems(),e._initializeHtmlListGroups()),e.grouped&&e._group(),e.sorted&&e._sort(),e._refreshLayout(),e._initializeSelection(),e.isInitialized=!0,e._canSort=e.autoSort,e.isUpdating--,e.itemTemplate&&e._handleItemTemplate(e.itemTemplate)&&(e._items.map((t=>e._applyTemplate(t))),e._refreshLayout()),e.__onCompleted&&(e._onCompleted=e.__onCompleted,e.__onCompleted=null,e._onCompleted()),e.topVisibleIndex>-1&&e._setTopVisibleIndex(e.topVisibleIndex),e.$.fireEvent("bindingComplete"),e._updateTopVisibleIndex(),0===e._items.length&&e.clearItems(),e._applyAriaSelected()};0===t.length?i():(e._onCompleted&&(e.__onCompleted=e._onCompleted,e._onCompleted=null),e._ensureItemsReady(t,i))}_ensureItemsReady(e,t){const i=this,r=function(){const i=function(t){for(let i=0;i<e.length;i++)e[i].context="node"===t?e[i]:document};i("node"),t(),i()};if(0===e.length)r();else{i._nodesReadyListeners=0;for(let t=0;t<e.length;t++){const o=e[t],s=function(){i._nodesReadyListeners--,0===i._nodesReadyListeners&&(r(),delete i._nodesReadyListeners)}.bind(i);o.isCompleted||(i._nodesReadyListeners++,o._onCompleted=s)}0===i._nodesReadyListeners&&r()}}_initializeInnerHTML(){const e=this;e.$.itemsInnerContainer.innerHTML.indexOf("<option")>=0?e.$.itemsInnerContainer.innerHTML=e.$.itemsInnerContainer.innerHTML.replace(/<optgroup/gi,"<smart-list-items-group").replace(/<\/optgroup/gi,"</smart-list-items-group").replace(/<option/gi,"<smart-list-item").replace(/<\/option/gi,"</smart-list-item"):e.$.itemsInnerContainer.innerHTML.indexOf("<ul")>=0&&(e.$.itemsInnerContainer.innerHTML=e.$.itemsInnerContainer.innerHTML.replace(/<ul/gi,"<smart-list-items-group").replace(/<\/ul/gi,"</smart-list-items-group").replace(/<li/gi,"<smart-list-item").replace(/<\/li/gi,"</smart-list-item"))}_initializeHtmlListItems(){const e=this,t=e.shadowRoot&&"shadow"===e.shadowDomMode?e.shadowRoot.querySelectorAll("smart-list-item"):e.querySelectorAll("smart-list-item"),i="checkBox"===e.selectionMode||"radioButton"===e.selectionMode?e.selectionMode:"plain",r=function(e,t,i){return void 0!==e[t]?""+e[t]:e[i]};e._items=[];let o=0;for(let s=0;s<t.length;s++){const l=t[s];l.dataIndex=s,l.label=l.innerHTML,l.dataItem=l,l.top||(l.top=o),l.height||(l.height=l.offsetHeight),o+=l.height,l.value||(l.value=""+s);const n=r(l,e.displayMember,"label"),a=r(l,e.valueMember,"value"),d=r(l,e.groupMember,"group");l.label!==n&&(l.label=n),l.value!==a&&(l.value=a),l.group!==d&&(l.group=d);const c=l.context;l.context=document,l.displayMode=i,l.context=c,e._alternateItem(l),l.selected&&(e.selectedIndexes.push(s),e.selectedValues.push(l.value)),e._items.push(l)}e.itemTemplate&&e._handleItemTemplate(e.itemTemplate)&&e._items.map((t=>e._applyTemplate(t)))}_group(){const e=this;e.isUpdating++;let t=[],i=[];e._canSort&&e._unsort();for(let i=0;i<e._items.length;i++){const r=e._items[i];let o=r.group?r.group.trim():r.innerHTML.charAt(0)||r.label.charAt(0);o+=" ",t[o]?t[o].items.push(r):t[t.length++]=t[o]={items:[r],label:o}}if(e.isVirtualized){e._groups=[];for(let e=0;e<t.length;e++){const r=t[e];r.dataIndex=e,r.grouped=!0,r.hidden=!1,r.displayMode="plain",i.push(r);for(let o=0;o<t[e].items.length;o++){const e=r.items[o];e.group=r,i.push(e)}}e._groups=t,e._items=i}else{for(;e.$.itemsInnerContainer.firstChild;)e.$.itemsInnerContainer.removeChild(e.$.itemsInnerContainer.firstChild);const r=document.createDocumentFragment();e._groups=[];for(let o=0;o<t.length;o++){const s=t[o],l=document.createElement("smart-list-items-group");l.label=s.label,l.dataIndex=o;for(let e=0;e<t[o].items.length;e++){const t=s.items[e];i.push(t),t.group=s.label,l.appendChild(t)}e._groups.push(l),r.appendChild(l)}e._items=i,/Trident|Edge/.test(navigator.userAgent)?setTimeout((function(){e.$.itemsInnerContainer.appendChild(r)}),50):e.$.itemsInnerContainer.appendChild(r)}e.sorted&&e._sort(),e.isUpdating--}_ungroup(){const e=this;e.isUpdating++,e._groups=[],e._canSort&&e._unsort();let t=[];if(e.isVirtualized)for(let i=0;i<e._items.length;i++){const r=e._items[i];r.grouped||t.push(r)}else{const i=document.createDocumentFragment();for(let r=0;r<e._items.length;r++){const o=e._items[r];i.appendChild(o),t.push(o)}t.length>0&&(e.$.itemsInnerContainer.innerHTML="",e.$.itemsInnerContainer.appendChild(i))}e._items=t,e.sorted&&e._sort(),e.isUpdating--}_initializeHtmlListGroups(){const e=this,t=e.$.itemsInnerContainer.querySelectorAll("smart-list-items-group");e._groups=[];for(let i=0;i<t.length;i++){const r=t[i];r.dataIndex=i,e._groups.push(r)}}_initializeSelection(){const e=this,t=e.selectedIndexes.slice(0),i=e.selectedValues.slice(0);e.clearSelection(),"oneOrManyExtended"===e.selectionMode&&(e._keysPressed.Control=!0);for(let r=0;r<e._items.length;r++){const o=e._items[r];(t.indexOf(r)>=0||i.indexOf(o.value||o.label)>=0)&&(e._focusedItem&&(e._focusedItem._focused=!1),e._focusedItem=null,e.select(o))}"oneOrManyExtended"===e.selectionMode&&(e._keysPressed.Control=!1)}onItemUpdated(){const e=this;e.isInitialized&&!e._isUpdating()&&(e.isUpdating++,e._refreshLayout(),e.isUpdating--)}_refreshItems(){const e=this;if(e.isInitialized&&!e._isUpdating()){if(e.isUpdating++,e.grouped?e._ungroup():e.sorted&&e._canSort&&e._unsort(),!e.isVirtualized){e._items=[];const t=e.shadowRoot?e.shadowRoot.querySelectorAll("smart-list-item"):e.querySelectorAll("smart-list-item");for(let i=0;i<t.length;i++)t[i].dataIndex=i,e._alternateItem(t[i]),e._items.push(t[i])}e.grouped?e._group():e.sorted&&e._sort(),e._refreshLayout(),e.isUpdating--}}_applyIncrementalSearch(e){const t=this;null===t.incrementalSearchDelay||isNaN(t.incrementalSearchDelay)||["Shift","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Control","Home","End","PageUp","PageDown"].indexOf(e)>-1||(0!==t._incrementalSearchQuery.indexOf(e)&&(t._incrementalSearchQuery+=e),t._incrementalSearchTimer&&clearTimeout(t._incrementalSearchTimer),t._incrementalSearch(),t._incrementalSearchTimer=setTimeout((function(){t._incrementalSearchQuery=""}),t.incrementalSearchDelay))}select(e){const t=this;if(("string"!=typeof e||(e=t.getItem(e)))&&("number"!=typeof e||(e=t.getItem(e)))&&!(e.grouped||e.readonly||!t._items.length||e instanceof HTMLElement&&!t.contains(e)&&!t.virtualized)){if("none"===t.selectionMode)return t.selectedIndexes=[],void(t.selectedValues=[]);switch(!t._focusedItem!==e&&"none"!==t.selectionMode&&(t._focusedItem&&(t._focusedItem._focused=!1),t._focusedItem=e,e._focused=!0),t.selectionMode){case"one":case"zeroAndOne":return(1!==t.selectedIndexes.length||t.selectedIndexes[0]!==t._indexOf(e))&&(t._previouslySelectedIndexes=t.selectedIndexes,t.selectedIndexes.length>=1&&t.clearSelection(),t._select(e),delete t._previouslySelectedIndexes,!0);case"zeroOrOne":return 1===t.selectedIndexes.length&&t.selectedIndexes[0]===t._indexOf(e)?(t.unselect(e),!0):(t._previouslySelectedIndexes=t.selectedIndexes,t.selectedIndexes.length>=1&&t.clearSelection(),t._select(e),delete t._previouslySelectedIndexes,!0);case"radioButton":if(t._previouslySelectedIndexes=t.selectedIndexes,t.$.itemsInnerContainer.querySelectorAll("smart-list-items-group").length>0){const i=e.parentNode;if(!e.selected){for(let e in i.children){const r=i.children[e];r.selected&&t.unselect(r)}t._select(e)}return delete t._previouslySelectedIndexes,!0}if(t.isVirtualized&&t._groups.length>0){const i=e.group;if(!e.selected){for(let e in i.items){const r=i.items[e];r.selected&&t.unselect(r)}t._select(e)}return delete t._previouslySelectedIndexes,!0}return e.selected||(t.selectedIndexes.length>=1&&t.clearSelection(),t._select(e)),delete t._previouslySelectedIndexes,!0;case"oneOrMany":return e.selected?t.selectedIndexes.length>1&&t.unselect(e):t._select(e),!0;case"zeroOrMany":case"checkBox":return e.selected?t.unselect(e):t._select(e),!0;case"oneOrManyExtended":{const i=t.selectedValues;if(t._keysPressed.Control)return t.selectedIndexes.length>1&&e.selected?(t.unselect(e),t._focus(t._items[t.selectedIndexes[0]])):t._select(e),!0;if(t._keysPressed.Shift){const r=t._items[t.selectedIndexes[0]];let o;t.clearSelection();const s=i.indexOf(r.value)>=0||r.selected;if(t._select(r,s),t._indexOf(r)>t._indexOf(e))for(o=t._indexOf(r)-1;o>=t._indexOf(e);){const e=t._items[o],r=i.indexOf(e.value)>=0||e.selected;t._select(e,r),o--}else for(o=t._indexOf(r)+1;o<=t._indexOf(e);){const e=t._items[o],r=i.indexOf(e.value)>=0||e.selected;t._select(e,r),o++}const l=[];for(let e=0;e<i.length;e++)l.push(t.getItem(i[e]));if(l.length>0&&!t._propertyChanging){let r=[];for(let e=0;e<t.selectedValues.length;e++){const o=t.selectedValues[e];i.indexOf(o)<0&&r.push(t.getItem(o))}t.$.fireEvent("change",{addedItems:r,removedItems:l,selected:e.selected,disabled:e.disabled,index:t._indexOf(e),label:e.label,value:e.value}),t._updateTargetValue()}return!0}for(let r=0;r<i.length;r++){const o=i[r],s=t.getItem(o);e!==s&&t.unselect(s)}return t.clearSelection(),t._select(e,i.indexOf(e.value)>=0),!0}}return!1}}_applyTemplate(e,t){const i=this;if(null===i.itemTemplate)return;if("function"==typeof i.itemTemplate)return void i.itemTemplate(e,{label:e.label,value:e.value,index:i._items.indexOf(e)});if(!i._bindingDetails||0===i._bindingDetails.length)return;const r=i._bindingDetails.length;let o,s,l=document.importNode(i._template.content,!0);for(let t=0;t<r;t++){o=l.childNodes[i._bindingDetails[t].childNodeIndex],s=i._bindingDetails[t].bindingString.length;for(let r=0;r<s;r++){const s=i._bindingDetails[t].bindingString[r],l=s.indexOf("label")>=0?e.label:e.value;o.innerHTML=o.innerHTML.replace(s,l)}}e.innerHTML="";for(let t=0;t<l.childNodes.length;t++)l.childNodes[t].outerHTML&&(e.innerHTML+=l.childNodes[t].outerHTML);!1!==t&&(i._scrollHeightTimer&&(clearInterval(i._scrollHeightTimer),i._scrollHeightCounter=0),i._scrollHeightTimer=setInterval((function(){i._lastScrollHeight===i.$.itemsInnerContainer.scrollHeight&&10!==i._scrollHeightCounter||(i._refreshLayout(),clearInterval(i._scrollHeightTimer)),i._lastScrollHeight=i.$.itemsInnerContainer.scrollHeight,i._scrollHeightCounter++}),50))}_filterItems(e,t,i){const r=this,o=r.$.filterInput.value;let s,l;const n=function(){if(0===l.length)return r._filteredItems=[],void(t&&t());s=r._queryItems(o,r.filterMode);for(let e=0;e<l.length;e++)l[e].hidden=!0,l[e].$&&l[e].$.addClass("smart-hidden");for(let e=0;e<s.length;e++){const t=s[e];t.hidden=!1,l[e].$&&t.$.removeClass("smart-hidden")}if(r.grouped&&r.isVirtualized)for(let e=0;e<r._groups.length;e++){const t=r._groups[e],i=t.items;let o=!0;for(let e=0;e<i.length;e++)i[e].hidden||(o=!1);o&&(t.hidden=!0)}if(r.grouped&&!r.isVirtualized)for(let e=0;e<r._groups.length;e++){const t=r._groups[e],i=[].concat(...t.querySelectorAll("smart-list-item"));let o=!0;for(let e=0;e<i.length;e++)i[e].$.hasClass("smart-hidden")||(o=!1);o?t.$.addClass("smart-hidden"):t.$.removeClass("smart-hidden")}if(r._filteredItems=s,r._refreshLayout(),t&&t(),e)return;const i=r._propertyChanging;r._propertyChanging=!0,r._refreshSelection(),r._propertyChanging=i};if("function"==typeof r.dataSource)if(o||i){const e=function(e){(o||i)&&r.isAttached&&(r._updateListBoxAfterQuery=function(){s=l=r._items,n()},r.clearItems(),r.insert(0,e))},t=r.dataSource(o,e);if(t){if(!o&&!i)return;r._updateListBoxAfterQuery=function(){s=l=r._items,n()},r.clearItems(),r.insert(0,t)}}else r.clearItems(),s=l=r._items,n(),r.$.fireEvent("bindingComplete");else{if(l=r._items,0===l.length)return;n()}}_getNextItem(e){const t=this._items,i=this._items.length;let r=Math.max(e+1,0);for(;r<i;){const e=t[r];if(!(e.disabled||e.hidden||e.grouped||e.readonly))return e;r++}return t[e]}_getPreviousItem(e){const t=this._items;let i=Math.max(e-1,0);for(;i>-1;){const e=t[i];if(!(e.disabled||e.hidden||e.grouped||e.readonly))return e;i--}return t[e]}get _scrollWidth(){const e=this,t=e._items;return e.__scrollWidth||(e.__scrollWidth=(()=>{const e=this,i=e.virtualized,r=e.itemMeasureMode;let o=0,s="";function l(t){const i=e._createItem({label:t});i.style.position="absolute",e.$.itemsContainer.appendChild(i),i.label=t,i.style.width="auto",i.isCompleted&&(i.$.itemContainer.style.width="auto");const r=getComputedStyle(i),o=parseInt(r.paddingLeft)+parseInt(r.paddingRight),s=i.$.itemContainer||i,l=s.offsetWidth+s.offsetLeft+o;return i.parentNode.removeChild(i),l}for(let e=0;e<t.length;e++){const n=t[e];if(!n.hidden)if("auto"===r){const e=i?n.label:n.textContent.trim();e.length>s.length&&(s=e)}else o=Math.max(o,l(n.label))}return"auto"===r?l(s):o})()),e.__scrollWidth}update(e,t){const i=this,r=i._items[e];if(r){if("string"==typeof t)r.label=t,void 0===r.value&&(r.value=t);else for(let e in t)"selected"===e&&r[e]!==t[e]?i.select(r):r[e]=t[e],"group"===e&&i._refreshItems();(i.sorted||i.grouped||i.isVirtualized)&&(i._refreshItems(),i._refreshSelection())}else i.error(i.localize("indexOutOfBound",{elementType:i.nodeName.toLowerCase(),method:"update"}))}insert(e,t){const i=this;let r=[];if((!e||e<0)&&(e=0),Array.isArray(t)){i.isUpdating++;const o=0===i._items.length;for(let s=0;s<t.length;s++){const l=t[s],n=i._createItem(l);r.push(n),e>=i._items.length||0===i._items.length||o?i.appendChild(n):i.insertBefore(n,i._items[e])}i.isUpdating--}else{const o=i._createItem(t);r.push(o),e>=i._items.length||0===i._items.length?i.appendChild(o):i.insertBefore(o,i._items[e])}if(r.length>0?(r.map((e=>i._applyTemplate(e))),i._ensureItemsReady(r,(function(){i._refreshItems(),0!==i._items.length&&(i._updateListBoxAfterQuery&&(i._updateListBoxAfterQuery(),delete i._updateListBoxAfterQuery),i._refreshSelection(),i.$.fireEvent("bindingComplete"))}))):i._updateListBoxAfterQuery&&(i._updateListBoxAfterQuery(),delete i._updateListBoxAfterQuery),i.virtualized&&i.filterable){const e=i.context;i.context=i,i.filterable&&(i.$.filterInput.value="",i._filterItems()),i.scrollTop=i.$.itemsContainer.scrollTop=0,i.scrollLeft=i.$.itemsContainer.scrollLeft=i._getScrollLeft(0),i.context=e}}add(e){const t=this;let i=[];if(e&&(!e||0!==e.length)){if(Array.isArray(e)){t.isUpdating++;for(let r=0;r<e.length;r++){const o=e[r],s=t._createItem(o);i.push(s),t.appendChild(s)}t.isUpdating--}else{const r=t._createItem(e);i.push(r),t.appendChild(r)}if(i.length>0?(i.map((e=>t._applyTemplate(e))),t._ensureItemsReady(i,(function(){t._refreshItems(),0!==t._items.length&&(t._updateListBoxAfterQuery&&(t._updateListBoxAfterQuery(),delete t._updateListBoxAfterQuery),t._refreshSelection(),t.$.fireEvent("bindingComplete"))}))):t._updateListBoxAfterQuery&&(t._updateListBoxAfterQuery(),delete t._updateListBoxAfterQuery),t.virtualized&&t.filterable){const e=t.context;t.context=t,t.filterable&&(t.$.filterInput.value="",t._filterItems()),t.scrollTop=t.$.itemsContainer.scrollTop=0,t.scrollLeft=t.$.itemsContainer.scrollLeft=t._getScrollLeft(0),t.context=e}else t.virtualized&&t._refreshLayout()}}removeItem(e){const t=this,i=t.getItem(e);if(i){if(i.selected&&t.unselect(i),t.isVirtualized){let e=t._items.indexOf(i);-1===e&&(e=t._items.indexOf(i)),t._items.splice(e,1)}else{i.parentNode.removeChild(i);let e=t._items.indexOf(i);-1===e&&(e=t._items.indexOf(i)),t._items.splice(e,1)}t._refreshItems(),t._refreshSelection(),0===t.selectedIndexes.length&&t._items.length>0&&("oneOrMany"!==t.selectionMode&&"one"!==t.selectionMode&&"oneOrManyExtended"!==t.selectionMode||t.select(t._items[0]))}}removeAt(e){const t=this,i=t._items[e];i?(i.selected&&t.unselect(i),t.isVirtualized||i.parentNode.removeChild(i),t._items.splice(e,1),t._refreshItems(),t._refreshSelection(),0===t.selectedIndexes.length&&t._items.length>0&&("oneOrMany"!==t.selectionMode&&"one"!==t.selectionMode&&"oneOrManyExtended"!==t.selectionMode||t.select(t._items[0]))):t.error(t.localize("indexOutOfBound",{elementType:t.nodeName.toLowerCase(),method:"remove"}))}_queryItems(e,t){const i=this,r=[],o=function(r,o){if(r.grouped)return r;switch(t){case"startsWith":if(0===r.label.indexOf(o))return r;break;case"startsWithIgnoreCase":if(0===r.label.toLowerCase().indexOf(o.toLowerCase()))return r;break;case"doesNotContain":if(r.label.indexOf(o)<0)return r;break;case"doesNotContainIgnoreCase":if(r.label.toLowerCase().indexOf(o.toLowerCase())<0)return r;break;case"contains":if(r.label.indexOf(o)>-1)return r;break;case"containsIgnoreCase":if(r.label.toLowerCase().indexOf(o.toLowerCase())>-1)return r;break;case"equals":if(0===r.label.localeCompare(o))return r;break;case"equalsIgnoreCase":if(0===r.label.toLowerCase().localeCompare(o.toLowerCase()))return r;break;case"endsWith":if(r.label.endsWith(o))return r;break;case"endsWithIgnoreCase":if(r.label.toLowerCase().endsWith(o.toLowerCase()))return r;break;case"custom":if(i.filterCallback(r,e))return r}return null};if(0===e.length)return i._items;for(let t=0;t<i._items.length;t++){const s=o(i._items[t],e);s&&r.push(s)}return r}_select(e,t){const i=this,r=i.selectedIndexes.indexOf(i._indexOf(e)),o=i.selectedIndexes.slice(0),s=i.selectedValues.slice(0);if(e.selected=!0,-1!==r)return i._recycle(),!1;if(o.push(i._indexOf(e)),s.push(e.value||e.label),i.selectedIndexes=o,i.selectedValues=s,i._recycle(),i.$.hiddenInput.value=s.toString(),!i.isCompleted||t||!i.isInitialized||i._propertyChanging)return;let l=[];if(i._previouslySelectedIndexes){for(let e=0;e<i._previouslySelectedIndexes.length;e++)i.selectedIndexes.indexOf(i._previouslySelectedIndexes[e])<0&&l.push(i._items[i._previouslySelectedIndexes[e]]);delete i._previouslySelectedIndexes}return i.$.fireEvent("change",{addedItems:[e],removedItems:l,selected:e.selected,disabled:e.disabled,index:i._indexOf(e),label:e.label,value:e.value}),i._updateTargetValue(),!0}_updateTargetValue(){const e=this;if(e.dataset.target){const t=document.querySelector(e.dataset.target);if(t){const i=e.dataset.property,r=e.value;i&&void 0!==t[i]&&(t[i]=r)}}}_setTopVisibleIndex(e){const t=this;if("number"==typeof e&&(t.topVisibleIndex=Math.max(0,e),e=t._items[t.topVisibleIndex]),!e)return!1;e.top!==t.scrollTop&&(t.scrollTop=e.top,t.isVirtualized||(t.$.itemsContainer.scrollTop=t.scrollTop),t.scrollHeight===t.scrollTop&&t._updateTopVisibleIndex())}_updateTopVisibleIndex(){const e=this,t=e.scrollTop+e._scrollView.verticalScrollBar.offsetHeight-e.offsetHeight;let i;if(e.scrollTop<e.scrollHeight/2){for(let r=0;r<e._items.length;r++)if(e._items[r].top>=t){i=e._items[r];break}}else for(let r=e._items.length-1;r>=0&&!(e._items[r].top<t);r--)i=e._items[r];if(i){const t=e.context;e.context=e,e.topVisibleIndex=i.dataIndex,e.context=t}}unselect(e){const t=this;if(!e)return;if("string"==typeof e&&!(e=t.getItem(e)))return;if("none"===t.selectionMode)return void t.clearSelection();const i=t.selectedIndexes.indexOf(t._indexOf(e)),r=t.selectedIndexes.slice(0),o=t.selectedValues.slice(0);return e.selected=!1,i>=0&&(r.splice(i,1),o.splice(i,1),t.selectedIndexes=r,t.selectedValues=o,t.$.hiddenInput.value=o.toString(),t.isCompleted&&!t._propertyChanging?(t.$.fireEvent("change",{addedItems:[],removedItems:[e],selected:e.selected,disabled:e.disabled,index:t._indexOf(e),label:e.label,value:e.value}),t._updateTargetValue(),t._recycle(),!0):void 0)}_handleItemTemplate(e){if(null===e||!e)return;if("function"==typeof e)return e;const t=this;if(!("content"in document.createElement("template")))return t.error(t.localize("htmlTemplateNotSuported",{elementType:t.nodeName.toLowerCase()})),void(t.itemTemplate=null);if(null===(e=document.getElementById(e))||!("content"in e))return t.error(t.localize("invalidTemplate",{elementType:t.nodeName.toLowerCase(),property:"itemTemplate"})),void(t.itemTemplate=null);const i=e.content,r=i.childNodes.length,o=/{{\w+}}/g;let s,l;t._bindingDetails=[],t._template=e;for(let e=0;e<r;e++){for(l=[];s=o.exec(i.childNodes[e].innerHTML);)l.push(s[0]);l.length>0&&t._bindingDetails.push({childNodeIndex:e,bindingString:l})}return!0}_handleKeyStrokes(e){const t=this,i="radioButton"===t.selectionMode||"checkBox"===t.selectionMode||"zeroOrMany"===t.selectionMode||"oneOrMany"===t.selectionMode||"zeroOrOne"===t.selectionMode;let r=t._items;if(t.filterable&&t.$.filterInput.value.length>0&&(r=t._filteredItems),!t.disabled&&!t.readonly&&r.length){switch(e){case"ArrowLeft":case"ArrowUp":t._handleArrowKeys(!0);break;case"ArrowRight":case"ArrowDown":t._handleArrowKeys(!1);break;case" ":{if(t.selectedIndexes.length<1&&!t._focusedItem)return;const e=t._focusedItem?t._focusedItem:t._items[t.selectedIndexes[t.selectedIndexes.length-1]],i=e=>{e.selected&&"radioButton"!==t.selectionMode?t.unselect(e):t.select(e)};if("oneOrMany"===t.selectionMode)return void(e.selected&&t.selectedIndexes.length>1?i(e):e.selected||i(e));i(e);break}case"Home":if(0===r.length)return;i||(t._keysPressed.Shift||t.clearSelection(),t.select(r[0])),t._focus(r[0]),t.scrollTop=0;break;case"End":if(0===r.length)return;i||(t._keysPressed.Shift||t.clearSelection(),t.select(r[r.length-1])),t._focus(r[r.length-1]),t.scrollTop=t.scrollHeight;break;case"PageUp":t._pageUpKeyHandler(r);break;case"PageDown":t._pageDownKeyHandler(r)}t._recycle()}}_horizontalScrollbarHandler(e){const t=this;e&&e.stopPropagation&&e.stopPropagation(),t.isVirtualized?t._recycle():t.$.itemsContainer.scrollLeft=t._getScrollLeft(e.detail.value)}_getScrollLeft(e,t){const i=this;if(!i.rightToLeft)return e;if(Smart.Utilities.Core.Browser.Chrome){if(!t){const e=2*(parseInt(getComputedStyle(i.$.itemsInnerContainer).getPropertyValue("--smart-list-item-horizontal-offset"))||0);t=i._scrollWidth-i.$.itemsContainer.offsetWidth-e}e=t-e}else e*=-1;return e}_unsort(){const e=this;e.isUpdating++;const t=function(e,t){let i=e.dataIndex,r=t.dataIndex;return i<r?-1:i>r?1:0};if(e.isVirtualized)if(e._groups.length>0){e._groups.sort(t);let i=[];for(let r=0;r<e._groups.length;r++){const o=e._groups[r],s=[].concat(...o.items);s.sort(t),i.push(o),i=i.concat(s)}e._items=i}else e._items.sort(t);else{if(e._groups.length>0){e._groups.sort(t);let i=[];for(let r=0;r<e._groups.length;r++){const o=e._groups[r],s=[].concat(...o.querySelectorAll("smart-list-item"));s.sort(t),i=i.concat(s)}e._items=i}else e._items.sort(t);e._applySortOrder()}e.isUpdating--}_applySortOrder(){const e=function(e){for(let t=0;t<e.length;t++){const i=e[t],r=i.parentNode;r&&r.appendChild(i)}};e(this._items),e(this._groups)}_sort(){const e=this;if(!e._canSort)return;e.isUpdating++;const t=function(t,i){let r=t.label,o=i.label;if("asc"===e.sortDirection){if(r<o)return-1;if(r>o)return 1}else{if(r<o)return 1;if(r>o)return-1}return 0};if(e._groups.sort(t),e.isVirtualized)if(e._groups.length>0){let i=[];for(let r=0;r<e._groups.length;r++){const o=e._groups[r],s=[].concat(...o.items);i.push(o),s.sort(t),i=i.concat(s)}e._items=i}else e._items.sort(t);else{if(e._groups.length>0){let i=[];for(let r=0;r<e._groups.length;r++){const o=e._groups[r],s=[].concat(...o.querySelectorAll("smart-list-item"));s.sort(t),i=i.concat(s)}e._items=i}else e._items.sort(t);e._applySortOrder()}e.isUpdating--}getItem(e){const t=this;for(let i=0;i<t._items.length;i++)if(t._items[i].value===e)return t._items[i];return null}_focus(e){const t=this;!e||"none"===t.selectionMode||t.disabled||t.readonly||(t._focusedItem&&(t._focusedItem._focused=!1),t._focusedItem=e,t._focusedItem._focused=!0)}_keyDownHandler(e){const t=this,i=(t.shadowRoot||t.getRootNode()).activeElement||document.activeElement;let r=e.key;if(e.metaKey&&(r="Control"),!t.disabled&&!t.readonly&&(!t.filterable||t.$.filterInput!==i)&&t._focused&&0!==t._items.length&&!t.disabled&&!t.displayLoadingIndicator){if(t.editable){if("F2"===r)return void t._dblclickEventHandler({target:t._focusedItem});if(t.$.editInput===i)return}if("none"!==t.selectionMode){switch(e.stopPropagation(),r){case"Down":case"Right":case"Left":case"Up":r="Arrow"+r}if(t.filterable)switch(r){case"ArrowLeft":case"ArrowRight":return;case"ArrowUp":case"ArrowDown":e.preventDefault()}if(t._applyIncrementalSearch(r),!(["Shift","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Control"," ","Home","End","PageUp","PageDown"].indexOf(r)<0))if(e.preventDefault(),!t._focusedItem&&t._items.length>0)"one"===t.selectionMode||"oneOrMany"===t.selectionMode||"oneOrManyExtended"===t.selectionMode?t.select(t._items[0]):t._focus(t._items[0]);else switch(t.selectionMode){case"one":case"zeroAndOne":if("Shift"===r||"Control"===r||" "===r)return;t._handleKeyStrokes(r);break;case"oneOrMany":case"zeroOrOne":case"zeroOrMany":case"radioButton":case"checkBox":if("Shift"===r||"Control"===r)return;t._handleKeyStrokes(r);break;case"oneOrManyExtended":if(" "===r)return;t._keysPressed[r]="keydown"===e.type,t._handleKeyStrokes(r)}}}}_keyUpHandler(e){const t=this,i=(t.shadowRoot||t.getRootNode()).activeElement||document.activeElement;if(!t.editable||t.$.editInput!==i){if(t.filterable&&t.$.filterInput===i)return t._filterTimer&&clearTimeout(t._filterTimer),void(t._filterTimer=setTimeout((function(){const e=t.context;t.context=t,t._filterItems(void 0,void 0,!0),t.scrollTop=t.$.itemsContainer.scrollTop=0,t.scrollLeft=t.$.itemsContainer.scrollLeft=t._getScrollLeft(0),t.context=e}),300));if(t._focused){if(t._focusedItem&&t._focusedItem.hidden&&t._filteredItems.length>0){let e=t._filteredItems[0];e.grouped&&t._filteredItems.length>1&&(e=t._filteredItems[1]),t._focus(e),t._recycle()}e.stopPropagation(),e.preventDefault(),t.disabled||("Escape"===e.key&&Smart.ListBox.DragDrop.Dragging&&t._cancelDrag(),["Shift","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Control"," ","PageUp","PageDown"].indexOf(e.key)<0||(t._keysPressed[e.key]=!1))}}}_cancelDrag(){if(!Smart.ListBox.DragDrop.Dragging)return;Smart.ListBox.DragDrop.Feedback.parentNode&&Smart.ListBox.DragDrop.Feedback.parentNode.removeChild(Smart.ListBox.DragDrop.Feedback);const e=Smart.ListBox.DragDrop.Item,t=e.ownerListBox;if(t.$.fireEvent("dragCancel",{item:e,data:Smart.ListBox.DragDrop,container:t,previousContainer:t}),Smart.ListBox.DragDrop.Feedback=null,Smart.ListBox.DragDrop.DropDetails){let e=Smart.ListBox.DragDrop.DropDetails.item;e&&(e.$.removeClass("smart-list-item-line-feedback"),e.$.removeClass("smart-list-item-bottom-line-feedback"))}document.body.classList.remove("smart-dragging"),delete Smart.ListBox.DragDrop.DraggedFrom,Smart.ListBox.DragDrop.Dragging=!1,Smart.ListBox.DragDrop.Item=null,Smart.ListBox.DragDrop.DropDetails=null}_mouseWheelNative(e,t){const i=this;void 0===i._scrollWheelContent&&(i._scrollWheelContent=document.createElement("div"),i._scrollWheelContent.style.width="100%",i._scrollWheelContent.style.height="100%",i._scrollWheelContent.style.position="absolute",i._scrollWheelContent.style.left="0px",i._scrollWheelContent.style.top="0px",i._scrollWheelContent.style.background="white",i._scrollWheelContent.style.zIndex=9999,i._scrollWheelContent.style.opacity=0,i._scrollWheelContent.style.overflow="auto",i._scrollWheelContent.style.visibility="hidden");let r=0;const o=()=>{if(t){const t=i._scrollWheelContent.scrollLeft;i._scrollView.hScrollBar.value=t,t===e&&i._scrollWheelContent.remove()}else{const t=i._scrollWheelContent.scrollTop;i._scrollView.vScrollBar.value=t,t===e&&i._scrollWheelContent.remove()}};i._scrollWheelContent.onscroll=()=>{cancelAnimationFrame(r),r=0,r=requestAnimationFrame(o)},i._scrollWheelContentView||(i._scrollWheelContentView=document.createElement("div"),i._scrollWheelContent.appendChild(i._scrollWheelContentView)),i._scrollWheelContentView.style.width=i.offsetWidth+i._scrollView.scrollWidth+"px",i._scrollWheelContentView.style.height=i.offsetHeight+i._scrollView.scrollHeight+"px",i.$.container.appendChild(i._scrollWheelContent),i._scrollWheelContent.scrollTop=i._scrollView.vScrollBar.value,i._scrollWheelContent.scrollLeft=i._scrollView.hScrollBar.value,!0===t?i._scrollWheelContent.scrollTo({top:i._scrollView.vScrollBar.value,left:e,behavior:"smooth"}):i._scrollWheelContent.scrollTo({top:e,left:i._scrollView.hScrollBar.value,behavior:"smooth"})}_mouseWheelHandler(e){const t=this;if(t._scrollView.hScrollBar.$.hasClass("smart-hidden")&&t._scrollView.vScrollBar.$.hasClass("smart-hidden"))return;if(42===e.pointerId)return;if(t._isUpdating())return;let i=!1;if(e.wheelDeltaY?120!==Math.abs(e.wheelDeltaY)&&240!==Math.abs(e.wheelDeltaY)&&360!==Math.abs(e.wheelDeltaY)&&(i=!0):0===e.deltaMode&&(i=!0),t.disabled||t._scrollView.vScrollBar.$.hasClass("smart-hidden")||e.shiftKey||!e.deltaY){if(!t.disabled&&(!t._scrollView.hScrollBar.$.hasClass("smart-hidden")||e.shiftKey)){e.stopPropagation(),e.preventDefault();let r=160;const o=0===e.deltaX?e.wheelDelta:e.deltaX;o<0&&(r=-160),Math.abs(o)>=100&&!i&&!Smart.Utilities.Core.Browser.Firefox?t._mouseWheelNative(t._scrollView.scrollLeft+r,!0):t._scrollView.scrollLeft+=o}}else{const r=t.scrollTop;if(0===r&&e.deltaY<0||r===t.scrollHeight&&e.deltaY>0)return;e.stopPropagation(),e.preventDefault();const o=t.itemHeight?t.itemHeight:30;let s=7*o;if(e.deltaY<=0&&(s=-7*o),Math.abs(e.deltaY)>=100&&!i&&!Smart.Utilities.Core.Browser.Firefox)t._mouseWheelNative(t._scrollView.scrollTop+s);else{t._wheelrafId=0;const i=()=>{t._scrollView.scrollTop+=e.deltaY};cancelAnimationFrame(t._wheelrafId),t._wheelrafId=0,t._wheelrafId=requestAnimationFrame(i)}}}_pageDownKeyHandler(e){const t=this;if(0===e.length)return;let i,r=t._items[t.selectedIndexes[t.selectedIndexes.length-1]];if("checkBox"!==t.selectionMode&&"radioButton"!==t.selectionMode&&"zeroOrMany"!==t.selectionMode&&"oneOrMany"!==t.selectionMode&&"zeroOrOne"!==t.selectionMode||t._focusedItem&&(r=t._focusedItem),!r)return;const o=t._indexOf(r);let s=r.top+t.$.itemsContainer.offsetHeight-r.height;for(let t=o;t<e.length;t++)if(e[t].top>=s){i=e[t];break}i||(i=e[e.length-1]),"checkBox"===t.selectionMode||"radioButton"===t.selectionMode||"zeroOrMany"===t.selectionMode||"oneOrMany"===t.selectionMode||"zeroOrOne"===t.selectionMode?t._focus(i):i.selected||(t._keysPressed.Shift||t.clearSelection(),t.select(i),t._focus(i)),(i.height+i.top>t.$.itemsContainer.scrollTop+t.$.itemsContainer.offsetHeight||i.top<t.$.itemsContainer.scrollTop)&&(t.scrollTop=i.top-t.$.itemsContainer.offsetHeight+i.height)}_pageUpKeyHandler(e){const t=this;if(0===e.length)return;let i=t._items[t.selectedIndexes[t.selectedIndexes.length-1]];if("checkBox"!==t.selectionMode&&"radioButton"!==t.selectionMode&&"zeroOrMany"!==t.selectionMode&&"oneOrMany"!==t.selectionMode&&"zeroOrOne"!==t.selectionMode||t._focusedItem&&(i=t._focusedItem),!i)return;const r=i.top-t.$.itemsContainer.offsetHeight;let o;for(let s=t._indexOf(i);s>0;s--)if(e[s].top<=r){o=e[s];break}o||(o=e[0]),"checkBox"===t.selectionMode||"radioButton"===t.selectionMode||"zeroOrMany"===t.selectionMode||"oneOrMany"===t.selectionMode||"zeroOrOne"===t.selectionMode?t._focus(o):o.selected||(t._keysPressed.Shift||t.clearSelection(),t.select(o),t._focus(o)),t.scrollTop=o.top,0===t._indexOf(o)&&(t.scrollTop=0)}clearItems(){const e=this;e.clearSelection(),e.$.itemsInnerContainer.innerHTML="",e._items=[],delete e._focusedItem,e.$placeholder.removeClass("smart-hidden"),e.refresh()}_resizeHandler(e){this.refresh(e)}refresh(e){const t=this;if(!e&&!t._isUpdatingScrollBars&&t.isInitialized)return t._isUpdatingScrollBars=!0,t._initializeRecyclingItems(),t._refreshLayout(),void(t._isUpdatingScrollBars=!1);e&&e.target===t&&!t._isUpdatingScrollBars&&(t._isUpdatingScrollBars=!0,t._initializeRecyclingItems(),t._refreshLayout(),t._isUpdatingScrollBars=!1)}_indexOf(e){const t=this;if(!e)return-1;let i=t._items.indexOf(e);return-1===i&&(i=t._items.indexOf(t.getItem(e.value))),i}_incrementalSearch(){const e=this,t="radioButton"!==e.selectionMode&&"checkBox"!==e.selectionMode&&"zeroOrMany"!==e.selectionMode&&"oneOrMany"!==e.selectionMode&&"zeroOrOne"!==e.selectionMode;let i,r=0;switch(e.incrementalSearchMode){case"containsIgnoreCase":case"equalsIgnoreCase":case"startsWithIgnoreCase":case"endsWithIgnoreCase":i=e._incrementalSearchQuery.toLowerCase();break;default:i=e._incrementalSearchQuery}const o=function(i){i.grouped||i.readonly||(t?(e.selectedIndexes.length>0&&e.clearSelection(),e._focus(i),e.select(i)):e._focus(i),(i.height+i.top>e.$.itemsContainer.scrollTop+e.$.itemsContainer.offsetHeight||i.top<e.scrollTop)&&(e.scrollTop=i.top),0===e._indexOf(i)&&(e.scrollTop=0),e._indexOf(i)===e._items.length-1&&(e.scrollTop=e.scrollHeight))};0!==e._previousEntry.localeCompare(i)&&(e._incrementalSearchItems=e._queryItems(e._incrementalSearchQuery,e.incrementalSearchMode),delete e._itemPosition),e._previousEntry=i;const s=e._incrementalSearchItems.length;if(0!==s)if(1!==s)for(void 0!==e._itemPosition?e._itemPosition<s-1?r=e._itemPosition:(r=0,t?(e._incrementalSearchItems[e._itemPosition].selected=!1,e.selectedIndexes=[],e.selectedValues=[]):e._incrementalSearchItems[e._itemPosition]._focused=!1):t&&e.clearSelection();r<s;r++)if(e._incrementalSearchItems[r].selected&&t)e._incrementalSearchItems[r].selected=!1,e.selectedIndexes=[],e.selectedValues=[];else{if(t||!e._incrementalSearchItems[r]._focused)return o(e._incrementalSearchItems[r]),void(e._itemPosition=r);e._incrementalSearchItems[r]._focused=!1}else o(e._incrementalSearchItems[0])}_selectStartHandler(e){const t=this,i=(t.shadowRoot||t.getRootNode()).activeElement;t.$.filterInput!==i&&t.$.editInput!==i&&e.preventDefault()}_handleArrowKeys(e){const t=this,i="radioButton"!==t.selectionMode&&"checkBox"!==t.selectionMode&&"zeroOrMany"!==t.selectionMode&&"oneOrMany"!==t.selectionMode&&"zeroOrOne"!==t.selectionMode;if(t.disabled||t.readonly)return;let r;if(t._focusedItem&&!t._keysPressed.Shift)r=t._indexOf(t._focusedItem),t._focusedItem._focused=!1;else{if(0===t.selectedIndexes.length)return;r=t.selectedIndexes[t.selectedIndexes.length-1]}const o=e?t._getPreviousItem(r):t._getNextItem(r);t._focus(o),i&&(t._keysPressed.Shift?t.select(o):t._items[r]!==o&&(t.clearSelection(),t.select(o))),t.ensureVisible(o)}_refreshFilter(){const e=this;if(e.filterable)return e.$.filterInput.disabled=!(!e.disabled&&!e.displayLoadingIndicator),e.$filterInputContainer.removeClass("smart-hidden"),void e.$itemsContainer.addClass("filter");e.$.filterInput.disabled=!0,e.$filterInputContainer.addClass("smart-hidden"),e.$itemsContainer.removeClass("filter")}_setFocusable(){const e=this;e.disabled||e.unfocusable?e.removeAttribute("tabindex"):e.tabIndex=e.tabIndex>0?e.tabIndex:0}_setLoadingIndicatorVisibility(){const e=this;e.displayLoadingIndicator?e.$loadingIndicatorContainer.hasClass("smart-visibility-hidden")?e.$loadingIndicatorContainer.removeClass("smart-visibility-hidden"):e.$loadingIndicatorContainer.removeClass("smart-hidden"):e._areCSSVarsSupported?e.$loadingIndicatorContainer.addClass("smart-hidden"):e.$loadingIndicatorContainer.addClass("smart-visibility-hidden")}_refreshLayout(){const e=this,t=e._filteredItems||e._items;if(e.__scrollHeight=null,e.__scrollWidth=null,e._height=null,e._scrollView||(e._scrollView=new Smart.Utilities.Scroll(e,e.$.horizontalScrollBar,e.$.verticalScrollBar)),e.$itemsContainer.removeClass("hscroll"),e.$itemsContainer.removeClass("vscroll"),!t||null===t||0===t.length)return e.scrollWidth=0,e.scrollHeight=0,e.$filterInputContainer.removeClass("vscroll"),e.$placeholder.removeClass("smart-hidden"),e.isVirtualized&&e._recycle(),void(e.$.itemsInnerContainer.style.width="");e.$placeholder.addClass("smart-hidden");const i=2*(parseInt(getComputedStyle(e.$.itemsContainer).getPropertyValue("--smart-list-item-horizontal-offset"))||0);let r=e._scrollWidth-e.$.itemsContainer.offsetWidth-i,o=e._scrollHeight;if(e._refreshHorizontalScrollBarVisibility(r),e._refreshVerticalScrollBarVisibility(o),e.$.itemsInnerContainer.style.width="","hidden"===e.horizontalScrollBarVisibility?e.$.itemsInnerContainer.style.width=e.$.itemsContainer.offsetWidth-i:e.$.itemsInnerContainer.style.width=Math.max(e.$.itemsContainer.offsetWidth-i,-i+e.__scrollWidth)+"px",e.computedVerticalScrollBarVisibility)return r=e._scrollWidth-e.$.itemsContainer.offsetWidth-i,e._refreshHorizontalScrollBarVisibility(r),"hidden"!==e.horizontalScrollBarVisibility&&(e.$.itemsInnerContainer.style.width="",e.$.itemsInnerContainer.style.width=Math.max(e.$.itemsContainer.offsetWidth-i,-i+e.__scrollWidth)+"px"),e.computedHorizontalScrollBarVisibility&&(("visible"!==e.horizontalScrollBarVisibility||0!==e.scrollWidth||"visible"===e.horizontalScrollBarVisibility)&&(e.__scrollHeight+=e._scrollView.hScrollBar.offsetHeight),e.scrollHeight=e.__scrollHeight,e._scrollView.hScrollBar.$.hasClass("bottom-corner")&&e._scrollView.hScrollBar.refresh()),void(e.isVirtualized&&e._recycle());r=e._scrollWidth-e.$.itemsContainer.offsetWidth-i,e._refreshHorizontalScrollBarVisibility(r),e.computedHorizontalScrollBarVisibility&&(e.scrollHeight=e._scrollHeight,e._refreshVerticalScrollBarVisibility(e.scrollHeight),e.computedVerticalScrollBarVisibility&&(r=e._scrollWidth-e.$.itemsContainer.offsetWidth-e._scrollView.vScrollBar.offsetWidth,e._refreshHorizontalScrollBarVisibility(r)),e._scrollView.vScrollBar.$.hasClass("bottom-corner")&&e._scrollView.vScrollBar.refresh(),e._scrollView.hScrollBar.$.hasClass("bottom-corner")&&e._scrollView.hScrollBar.refresh()),e.isVirtualized&&e._recycle();const s=/Trident|Edge/.test(navigator.userAgent);!e.isRefreshing&&s&&setTimeout((function(){e.isRefreshing=!0,e._refreshLayout(),e.isRefreshing=!1}),50)}_styleChangedHandler(){this._refreshLayout()}_swipeLeftHandler(){}_swipeRightHandler(){}_refreshHorizontalScrollBarVisibility(e){const t=this;t.scrollWidth=e,t.$.horizontalScrollBar.refresh(),t.computedHorizontalScrollBarVisibility?(t.scrollLeft=t._getScrollLeft(t.$.itemsContainer.scrollLeft,e),t.$itemsContainer.addClass("hscroll")):t.$itemsContainer.removeClass("hscroll")}_refreshVerticalScrollBarVisibility(e){const t=this;t.scrollHeight=e,t.$.verticalScrollBar.refresh(),t.computedVerticalScrollBarVisibility?(t.$itemsContainer.addClass("vscroll"),t.$filterInputContainer.addClass("vscroll")):(t.$itemsContainer.removeClass("vscroll"),t.$filterInputContainer.removeClass("vscroll"))}_validateTemplate(e,t){if(null===t||!t)return;const i=this;return"content"in document.createElement("template")?null!==(t=document.getElementById(t))&&"content"in t?t:(i.error(i.localize("invalidTemplate",{elementType:i.nodeName.toLowerCase(),property:e})),void(i[e]=null)):(i.error(i.localize("htmlTemplateNotSuported",{elementType:i.nodeName.toLowerCase()})),void(i[e]=null))}_getItemIndexByPosition(e){const t=this;return(i=>{let r=0,o=i.length-1;if(e<=0)return 0;if(i[i.length-1].top<=e)return i.length-1;for(;;){const s=Math.floor((r+o)/2),l=i[s];if(t._isItemInPosition(l,e))return s;l.top<e?r=s+1:l.top>e&&(o=s-1)}})(t.$.filterInput.value.length>0?t._filteredItems:t._items)}_isItemInPosition(e,t){const i=e.top,r=e.top+e.height;return i<=t&&r>t}get isVirtualized(){const e=this;return e.virtualized&&e.dataSource&&e.dataSource.length>0}_recycle(){const e=this;if(!e._recyclingItems)return;let t=e._height;e._height||(t=e._height=e.$.itemsContainer.offsetHeight);let i=0;const r=e.scrollTop,o=e._getItemIndexByPosition(r),s=e.filterable&&e.$.filterInput.value.length>0?e._filteredItems:e._items,l=s[o];let n=l?l.top:0;if(e.$.itemsInnerContainer.style.left=-e.scrollLeft+"px",e.$.itemsInnerContainer.style.top=-r+n+"px",e.isUpdating++,o>=0){const l=s.length;for(let a=o;a<l;a++){const o=s[a];if(0!==o.height){if(!(n+o.height>=r&&n<=r+t))break;{const t=e._recyclingItems[i++];if(!t)break;t.setAttribute("aria-setsize",l),t.setAttribute("aria-posinset",a),t.context=document,t.dataItem=o,t.label=o.label,t.value=o.value,t.selected=o.selected,t._focused=o._focused,t.hidden=o.hidden,t.grouped=o.grouped,t.readonly=o.readonly,t.style.height=o.height+"px",e._alternateItem(t),o.title?t.title=o.title:t.title="",o.grouped?t.displayMode="plain":t.displayMode=o.displayMode,e.scrollWidth>0&&(t.style.width=e.$.itemsInnerContainer.offsetWidth+e.scrollWidth+"px"),e.itemTemplate&&e._handleItemTemplate(e.itemTemplate)&&e._applyTemplate(t,!1)}n+=o.height}}}if(i<e._recyclingItems.length)for(let t=i;t<e._recyclingItems.length;t++){const t=e._recyclingItems[i++],r=t.context;t.context=document,t.hidden=!0,t.context=r}e.isUpdating--}_verticalScrollbarHandler(e){const t=this,i=e.detail.value;e&&e.stopPropagation&&e.stopPropagation(),t.isVirtualized?t._recycle():t.$.itemsContainer.scrollTop=i,t._updateTopVisibleIndex(),e.context.max!==e.context.value?e.context.min===e.context.value&&t.$.fireEvent("scrollTopReached"):t.$.fireEvent("scrollBottomReached")}_applyAriaSelected(){const e=this,t=e.isVirtualized?e._recyclingItems:e._items,i=e.selectionMode;for(let e=0;e<t.length;e++){const r=t[e];r.selected?r.setAttribute("aria-selected",!0):r.readonly||r.disabled||-1===["oneOrManyExtended","zeroOrMany","oneOrMany","checkBox"].indexOf(i)?r.removeAttribute("aria-selected"):r.setAttribute("aria-selected",!1)}}});
|
|
6
|
+
Smart("smart-list-item",class extends Smart.ContentElement{static get properties(){return{alternationIndex:{value:-1,type:"int"},color:{value:"",type:"string"},displayMode:{allowedValues:["plain","checkBox","radioButton"],value:"plain",type:"string"},grouped:{value:!1,type:"boolean"},selected:{value:!1,type:"boolean"},indeterminate:{value:!1,type:"boolean"},value:{value:"",type:"any"},valueName:{value:"",type:"any"},label:{value:"",type:"string"},sanitizeHTML:{value:!1,type:"boolean"},details:{value:"",type:"string"},group:{value:"",type:"string"},hidden:{value:!1,type:"boolean"},readonly:{value:!1,type:"boolean"}}}get hasStyleObserver(){return!1}get enableShadowDOM(){return!1}get _focused(){const e=this;return void 0===e.__focused&&(e.__focused=!1),e.__focused}set _focused(e){const t=this;t.__focused=e,e?(t.setAttribute("focus",""),t.ownerListBox&&t.ownerListBox.ownerElement&&Smart.ComboBox&&t.ownerListBox.ownerElement instanceof Smart.ComboBox&&t.ownerListBox.ownerElement.$.input.setAttribute("aria-activedescendant",t.id)):t.removeAttribute("focus")}template(){return'<div id="container">\n <span id=\'itemInput\' class=\'smart-input smart-hidden\'></span>\n <span class="smart-overlay" id="overlay"></span>\n <div id="itemContainer" class="smart-list-item-label-element smart-content smart-list-item-container"><span class="smart-content-label" inner-h-t-m-l=\'[[innerHTML]]\' role="presentation"><content></content></span><span inner-h-t-m-l=\'[[details]]\' id="details" class="smart-content-details"></span></div>\n </div>'}appendChild(e){const t=this;if(!t.isCompleted||e.classList&&e.classList.contains("smart-ripple")){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.appendChild.apply(t,e.concat(Array.prototype.slice.call(arguments)))}window.smartBlazor?t.$.itemContainer.appendChild(e):(t.$.itemContainer.innerHTML="",e instanceof HTMLElement&&t.$.itemContainer.appendChild(e))}insertBefore(e,t){const i=this;if(!i.isCompleted){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.insertBefore.apply(i,e.concat(Array.prototype.slice.call(arguments)))}t.parentNode.insertBefore(e,t)}removeChild(e){const t=this;if(!t.isCompleted||e.classList.contains("smart-ripple")){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.removeChild.apply(t,e.concat(Array.prototype.slice.call(arguments)))}e instanceof HTMLElement&&t.$.itemContainer.removeChild(e)}attached(){const e=this;super.attached(),e.ownerListBox=e.getListBox(),e.ownerListBox&&(e.ownerListBox.onClick&&(e.onpointerdown=t=>{e.ownerListBox.onClick(t)}),e.ownerListBox.onDoubleClick&&(e.ondblclick=t=>{e.ownerListBox.onDoubleClick(t)}))}static get listeners(){return{mouseenter:"_itemOnMouseEnter",mouseleave:"_itemOnMouseLeave"}}ready(){super.ready();const e=this;if(e.setAttribute("role","option"),""!==e.label){let t=e.label;t&&"string"==typeof t&&e.sanitizeHTML&&(t=t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/'/g,"'").replace(/"/g,""")),e.innerHTML=t}else""!==e.innerHTML&&(e.label=e.innerHTML);e._setDisplayMode(e.displayMode),e._setItemColor(),e.$.container.noRipple=!0;const t=e.closest("smart-list-box");if(t&&t.isRendered){if(cancelAnimationFrame(Smart.ListBox.processTimer),t._inLazyInit||t._isUpdating)return;Smart.ListBox.processTimer=requestAnimationFrame((()=>{t._lazyInitItems()}))}}propertyChangedHandler(e,t,i){const l=this;if(super.propertyChangedHandler(e,t,i),"hidden"===e)i?l.$.addClass("smart-hidden"):l.$.removeClass("smart-hidden");else if("color"===e)l._setItemColor();else if("displayMode"===e)l._setDisplayMode(i);else if("label"===e||"value"===e){const t=l.context;l.context=document,"label"===e&&(l.innerHTML=i);const r=l.getListBox();r&&(r._applyTemplate(l),r.onItemUpdated(l)),l.context=t}else if("details"===e){const e=l.context;l.context=document,l.$.details.innerHTML=i;const t=l.getListBox();t&&t.onItemUpdated(l),l.context=e}else if("innerHTML"===e){const e=l.getListBox();e&&e.onItemUpdated(l)}else if("selected"===e)if(i)l.setAttribute("aria-selected",!0);else{const e=l.getListBox();l.readonly||l.disabled||!e||-1===["oneOrManyExtended","zeroOrMany","oneOrMany","checkBox"].indexOf(e.selectionMode)?l.removeAttribute("aria-selected"):l.setAttribute("aria-selected",!1)}}getListBox(){const e=this;if(!Smart.ListBox)return e.getRootNode().host;let t=e.parentNode;for(;t instanceof Smart.ListBox==0&&null!==t;)t=t.parentNode;return!t&&Smart.EnableShadowDOM?e.getRootNode().host:t}_itemOnMouseEnter(){const e=this;!e.disabled&&e.ownerListBox&&(Smart.ListBox.DragDrop.Dragging&&e.ownerListBox.allowDrop&&(Smart.ListBox.DragDrop.DropDetails={item:e,position:"bottom"}),e.ownerListBox.$.verticalScrollBar.thumbCapture||e.ownerListBox.$.horizontalScrollBar.thumbCapture||(e.ownerListBox&&e.ownerListBox.$.fireEvent("itemHover",{label:e.label,value:e.value,disabled:e.disabled,selected:e.selected}),e.setAttribute("hover","")))}_itemOnMouseMove(e){const t=this;if(t.ownerListBox&&Smart.ListBox.DragDrop.Dragging&&t.ownerListBox.allowDrop&&!Smart.Utilities.Core.isMobile){const i=[].slice.call(t.ownerListBox.getElementsByClassName("smart-list-item-bottom-line-feedback"));for(let e=0;e<i.length;e++)i[e].$.removeClass("smart-list-item-line-feedback"),i[e].$.removeClass("smart-list-item-bottom-line-feedback");if(Smart.ListBox.DragDrop.DropDetails={item:t,position:"top"},!t.ownerListBox._areCSSVarsSupported){if(t.ownerListBox._indexOf(t)===t.ownerListBox._items.length-1||t.parentNode.lastElementChild===t){const i=t.getBoundingClientRect();e.pageY-window.pageYOffset>i.top+i.height/2-1&&(Smart.ListBox.DragDrop.DropDetails={item:t,position:"bottom"})}return}if(t.$.removeClass("smart-list-item-line-feedback"),t.$.removeClass("smart-list-item-bottom-line-feedback"),t.ownerListBox.sorted&&t.ownerListBox.autoSort)return;const l=t.ownerListBox._items.filter((e=>!e.hidden));if(l.indexOf(t)===l.length-1||t.parentNode.lastElementChild===t){const i=t.getBoundingClientRect();e.pageY-window.pageYOffset>i.top+i.height/2-1?(t.$.addClass("smart-list-item-bottom-line-feedback"),Smart.ListBox.DragDrop.DropDetails={item:t,position:"bottom"}):arguments[1]||t.$.addClass("smart-list-item-line-feedback")}else arguments[1]||t.$.addClass("smart-list-item-line-feedback")}}_itemOnMouseLeave(){const e=this;e.ownerListBox&&(Smart.ListBox.DragDrop.Dragging&&(e.$.removeClass("smart-list-item-line-feedback"),e.$.removeClass("smart-list-item-bottom-line-feedback")),e.removeAttribute("hover"))}_setDisplayMode(e){const t=this,i=t.getListBox();if(i){const l="checkBox"===i.selectionMode||"radioButton"===i.selectionMode?i.selectionMode:"plain";t.displayMode=e=l}"plain"!==e?t.$itemInput.removeClass("smart-hidden"):t.$itemInput.addClass("smart-hidden")}_setItemColor(){const e=this,t=e.querySelector(".smart-content-label"),i=/(^#[0-9A-F]{3}$)|(^#[0-9A-F]{6}$)|(^#[0-9A-F]{8}$)/i.test(e.color)?e.color:"";t.style.backgroundColor=i,t.style.color=e._getContrastColor(i)}_getContrastColor(e){if(!e)return"";let t=(i=e.slice(1,3),l=e.slice(3,5),r=e.slice(5,7),[parseInt(i,16),parseInt(l,16),parseInt(r,16)]);var i,l,r;return parseFloat(((.299*t[0]+.61*t[1]+.114*t[2])/255).toFixed(2))>.65?"#000000":"#FFFFFF"}}),Smart("smart-list-items-group",class extends Smart.ContentElement{static get properties(){return{label:{value:"",type:"string"}}}get enableShadowDOM(){return!1}template(){return'<div id="container" role="presentation">\n <span id="itemsLabel" class="smart-list-items-group-label">[[label]]</span>\n <div id="listItemsGroupContainer" inner-h-t-m-l=\'[[innerHTML]]\' class="smart-list-items-group-container" role="presentation">\n <content></content>\n </div>\n </div>'}appendChild(e){const t=this;if(!t.isCompleted){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.appendChild.apply(t,e.concat(Array.prototype.slice.call(arguments)))}e instanceof HTMLElement&&t.$.listItemsGroupContainer.appendChild(e)}removeChild(e){const t=this;if(!t.isCompleted){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.removeChild.apply(t,e.concat(Array.prototype.slice.call(arguments)))}e instanceof HTMLElement&&t.$.listItemsGroupContainer.removeChild(e)}getListBox(){let e=this.parentNode;for(;e instanceof Smart.ListBox==0&&null!==e;)e=e.parentNode;return e}attached(){const e=this;super.attached(),e.ownerListBox||(e.ownerListBox=e.getListBox()),e.setAttribute("role","group"),e.$.itemsLabel.id||(e.$.itemsLabel.id=e.id+"Label"),e.setAttribute("aria-labelledby",e.$.itemsLabel.id)}}),Smart("smart-list-box",class extends Smart.ScrollViewer{static get properties(){return{allowDrag:{value:!1,type:"boolean"},allowDrop:{value:!1,type:"boolean"},alternationStart:{value:0,type:"int"},alternationEnd:{value:0,type:"int"},alternationCount:{value:0,type:"int"},autoSort:{value:!0,type:"boolean"},dataSource:{value:null,type:"any?",reflectToAttribute:!1},dragFeedbackFormatFunction:{value:null,type:"function?"},dragOffset:{value:[10,10],type:"array"},displayLoadingIndicator:{value:!1,type:"boolean"},displayMember:{value:"",type:"string"},shadowDomMode:{allowedValues:["light","shadow"],value:"shadow",type:"string"},dropAction:{value:"move",type:"string",allowedValues:["copy","move","none"]},editable:{value:!1,type:"boolean"},filterable:{value:!1,type:"boolean"},filterCallback:{value:null,type:"function?"},filterMode:{value:"containsIgnoreCase",allowedValues:["contains","containsIgnoreCase","doesNotContain","doesNotContainIgnoreCase","equals","equalsIgnoreCase","startsWith","startsWithIgnoreCase","endsWith","endsWithIgnoreCase","custom"],type:"string"},filterInputPlaceholder:{value:"",type:"string"},grouped:{value:!1,type:"boolean"},groupMember:{value:"",type:"string"},itemTemplate:{value:null,type:"any"},itemHeight:{value:null,type:"number?"},incrementalSearchDelay:{value:700,type:"number?"},incrementalSearchMode:{value:"startsWithIgnoreCase",allowedValues:["contains","containsIgnoreCase","doesNotContain","doesNotContainIgnoreCase","equals","equalsIgnoreCase","startsWith","startsWithIgnoreCase","endsWith","endsWithIgnoreCase"],type:"string"},itemMeasureMode:{value:"auto",allowedValues:["auto","precise"],type:"string"},loadingIndicatorPlaceholder:{value:"Loading...",type:"string"},loadingIndicatorPosition:{value:"center",allowedValues:["bottom","center","top"],type:"string"},messages:{extend:!0,value:{en:{selectAll:"(Select All)",overridingProperties:'{{elementType}}: Overriding properties {{property1}} and {{property2}} applied. The "{{property1}}" property is used by default.',invalidIndex:'{{elementType}}: "{{method}}" method accepts an index of type number or an Array of numbers.',indexOutOfBound:'{{elementType}}: Out of bound index/indexes in "{{method}}" method.',invalidItem:'{{elementType}}: "{{method}}" method accepts an object or an array of objects as it\'s second parameter.',invalidSettings:'{{elementType}}: "{{method}}" method accepts a string or an object as it\'s second parameter.'}},type:"object"},name:{value:"",type:"string"},placeholder:{value:"No Items",type:"string"},selectedIndexes:{value:[],type:"array"},selectedValues:{value:[],type:"array"},selectionMode:{value:"oneOrManyExtended",allowedValues:["none","oneOrManyExtended","zeroOrMany","oneOrMany","zeroOrOne","zeroAndOne","one","checkBox","radioButton"],type:"string"},selectAll:{value:!1,type:"boolean"},selectionChangeAction:{value:"release",allowedValues:["press","release"],type:"string"},sorted:{value:!1,type:"boolean"},sortDirection:{value:"asc",type:"string"},topVisibleIndex:{value:-1,type:"int"},type:{value:"list",type:"string",defaultReflectToAttribute:!0,readonly:!0},valueMember:{value:"",type:"string"},virtualized:{value:!1,type:"boolean"},onClick:{value:null,type:"any",reflectToAttribute:!1},onDoubleClick:{value:null,type:"any",reflectToAttribute:!1}}}static get requires(){return{"Smart.ScrollBar":"smart.scrollbar.js"}}static get styleUrls(){return["smart.listbox.css","smart.dropdown.css","smart.scrollbar.css"]}static get listeners(){return{focus:"_focusHandler",blur:"_blurHandler","container.wheel":"_mouseWheelHandler","editInput.change":"_editInputEventHandler","editInput.blur":"_editInputEventHandler","editInput.keydown":"_editInputEventHandler","horizontalScrollBar.change":"_horizontalScrollbarHandler","itemsInnerContainer.down":"_downHandler","itemsInnerContainer.dblclick":"_dblclickEventHandler","itemsInnerContainer.move":"_itemsContainerMoveHandler","itemsContainer.mouseleave":"_mouseLeaveHandler","itemsInnerContainer.touchmove":"_touchmoveHandler","itemsInnerContainer.touchstart":"_touchstartHandler","document.move":"_moveHandler",keydown:"_keyDownHandler",keyup:"_keyUpHandler",resize:"_resizeHandler",selectstart:"_selectStartHandler",styleChanged:"_styleChangedHandler",swipeleft:"_swipeLeftHandler",swiperight:"_swipeRightHandler",touchmove:"_overriddenHandler",touchstart:"_overriddenHandler","verticalScrollBar.change":"_verticalScrollbarHandler"}}template(){return'<div id="container" class="smart-container" role="presentation">\n <div class="smart-list-box-filter-input-container smart-hidden" id="filterInputContainer" role="presentation"><input id="filterInput" disabled="[[disabled]]" placeholder=\'[[filterInputPlaceholder]]\' role="searchbox" aria-label="Filter Input"></div>\n <div id="itemsContainer" class="smart-list-items-container" role="presentation">\n <div id="placeholder" class="smart-placeholder" role="presentation" aria-hidden="true">[[placeholder]]</div>\n <div id="itemsInnerContainer" inner-h-t-m-l=\'[[innerHTML]]\' class="smart-list-items-inner-container" role="presentation">\n <content></content>\n </div>\n <input type="text" id="editInput" class= "smart-hidden"/>\n </div>\n <smart-scroll-bar wait theme="[[theme]]" right-to-left="[[rightToLeft]]" id="verticalScrollBar" disabled="[[disabled]]" orientation="vertical"></smart-scroll-bar>\n <smart-scroll-bar wait theme="[[theme]]" right-to-left="[[rightToLeft]]" id="horizontalScrollBar" disabled="[[disabled]]"></smart-scroll-bar>\n <div id="loadingIndicatorContainer" class="smart-loader-container" role="presentation">\n <span id="loadingIndicator" class="smart-loader" role="img" aria-label="[[loadingIndicatorPlaceholder]]"></span>\n <span id="loadingIndicatorPlaceHolder" class="smart-loader-label smart-hidden">[[loadingIndicatorPlaceholder]]</span>\n </div>\n <input id="hiddenInput" type="hidden" name="[[name]]">\n </div>'}get value(){const e=this;return e.isRendered&&e._selectedItems.length>0?e._selectedItems.map((e=>({label:e.label,value:e.value}))):null}set value(e){const t=this;if(Array.isArray(e)){const i=t.context;t.context=t,t._isUpdating++,t.selectedValues=[],t.clearSelection();for(let i=0;i<e.length;i++){const l=e[i],r=t.getItem(l);r&&("oneOrManyExtended"===t.selectionMode?t._select(r):t.select(r))}return t.context=i,void t._isUpdating--}const i=t.getItem(e);i&&t.select(i)}get _selectedItems(){const e=this,t=[];if(e.isRendered)for(let i=0;i<e._items.length;i++){const l=e._items[i];l.selected&&t.push(l)}return t}_mouseLeaveHandler(){const e=[].slice.call(this.getElementsByClassName("smart-list-item-bottom-line-feedback"));for(let t=0;t<e.length;t++)e[t].$.removeClass("smart-list-item-line-feedback"),e[t].$.removeClass("smart-list-item-bottom-line-feedback")}_downHandler(e){const t=this;if(t.disabled||t.displayLoadingIndicator||t.readonly)return;let i=e.originalEvent.target,l=null;if(!(i instanceof Smart.ListItem)||i.disabled||i.hidden||i instanceof Smart.ListItemsGroup)for(;i.parentElement;){if(i instanceof Smart.ListItem&&!i.disabled&&!i.hidden&&!(i instanceof Smart.ListItemsGroup)){l=i.dataItem;break}i=i.parentElement}else l=i.dataItem;Smart.ListBox.DragDrop.StartTime=new Date,Smart.ListBox.DragDrop.StartPosition={left:e.pageX,top:e.pageY},l&&(e.stopPropagation(),t.hasRippleAnimation&&(l.readonly||l.disabled||Smart.Utilities.Animation.Ripple.animate(i.$.overlay,e.pageX,e.pageY)),Smart.Utilities.Core.isMobile||"press"!==t.selectionChangeAction||(t._focus(l),t.select(l)),!Smart.ListBox.DragDrop.Feedback&&t.allowDrag&&(Smart.ListBox.DragDrop.DraggedFrom=t,Smart.ListBox.DragDrop.Feedback=document.createElement("span"),t.rightToLeft?Smart.ListBox.DragDrop.Feedback.setAttribute("right-to-left",!0):Smart.ListBox.DragDrop.Feedback.removeAttribute("right-to-left"),t.dragFeedbackFormatFunction?Smart.ListBox.DragDrop.Feedback.innerHTML=t.dragFeedbackFormatFunction(l):Smart.ListBox.DragDrop.Feedback.appendChild(l.offsetHeight?l.cloneNode(!0):t._createItem(l)),Smart.ListBox.DragDrop.Item=l,Smart.Utilities.Extend(Smart.ListBox.DragDrop.Feedback).addClass("smart-popup smart-list-item smart-list-item-feedback")))}_dblclickEventHandler(e){const t=this;if(!t.editable)return;const i=e.target.closest("smart-list-item");i instanceof Smart.ListItem&&!i.disabled&&!i.readonly?(t.$.editInput.dir=t.rightToLeft?"rtl":"ltr",t.$.editInput.style.width=t.$.itemsInnerContainer.offsetWidth+"px",t.$.editInput.owner=i,t.$.editInput.value=i.label,t.$.editInput.style.height=i.offsetHeight+"px",t.$.editInput.style.top=i.offsetTop+t.$.itemsInnerContainer.offsetTop+"px",t.$.editInput.setAttribute("aria-label","Edit item "+i.label),t.$editInput.hasClass("smart-hidden")&&t.$editInput.removeClass("smart-hidden"),t.$.editInput.focus({preventScroll:!0})):t.$editInput.addClass("smart-hidden")}_editInputEventHandler(e){const t=this;if("blur"===e.type||"keydown"===e.type&&"Escape"===e.key)return t.$editInput.hasClass("smart-hidden")||t.$editInput.addClass("smart-hidden"),void t.focus();if("keydown"===e.type||t.$editInput.hasClass("smart-hidden"))return;const i=e.target;if(e.stopPropagation(),i.owner.label!==i.value&&(i.owner.label=i.value,t.itemTemplate&&t._applyTemplate(i.owner),t.dataSource)){const e=i.owner.dataIndex,l=t.dataSource[e];l&&(t.displayMember?l[t.displayMember]=i.value:l.label=i.value)}t.$editInput.addClass("smart-hidden"),t.$.fireEvent("itemLabelChange",{selected:i.owner.selected,disabled:i.owner.disabled,index:t._indexOf(i.owner),label:i.owner.label,value:i.owner.value})}_pointerUpHandler(e){const t=this;let i=e.originalEvent,l=i.target;(t.shadowRoot||t.isInShadowDOM)&&(l=i.originalEvent?i.originalEvent.composedPath()[0]:i.composedPath()[0]);const r=e=>{const i=e.ownerListBox;if(!(i.disabled||i!==t||i.displayLoadingIndicator||"none"===i.selectionMode||e.grouped||e.readonly)){if(i._focus(e),"selectAll"===e.value&&(t._propertyChanging=!0),i.select(e),"selectAll"===e.value){t._propertyChanging=!1;const l=t._filteredItems?t._filteredItems:t._items;e.selected?i.checkAll(l.slice(0)):i.uncheckAll(l.slice(1))}t.selectAll&&((t._filteredItems?t._filteredItems:t._items)[0].indeterminate=!1,"selectAll"!==e.value&&t._refreshSelectAll()),Smart.ListBox.DragDrop.StartPosition=null,t.$.fireEvent("itemClick",{selected:l.selected,disabled:l.disabled,index:t._indexOf(l),label:l.label,value:l.value})}};if(!(i.target instanceof Smart.ListItem)||i.target.disabled||i.target instanceof Smart.ListItemsGroup){for(;l&&l.parentElement;){if(l instanceof Smart.ListItem&&!l.disabled&&!(l instanceof Smart.ListItemsGroup))return void r(l.dataItem);l=l.parentElement}if(this.shadowRoot&&"shadow"===this.shadowDomMode){const e=i.composedPath();for(let t=0;t<e.length;t++){const i=e[t];i instanceof Smart.ListItem&&!i.disabled&&r(i.dataItem)}}}else r(l.dataItem)}_upHandler(e){const t=this;if(super._upHandler(),!t.disabled&&!t.readonly&&Smart.ListBox.DragDrop.StartPosition){if(Smart.Utilities.Core.isMobile&&!Smart.ListBox.DragDrop.Dragging){const i=Math.abs(e.pageX-Smart.ListBox.DragDrop.StartPosition.left),l=Math.abs(e.pageY-Smart.ListBox.DragDrop.StartPosition.top);let r=i>=0&&i<=3&&l>=0&&l<=3;if(Smart.Utilities.Core.isMobile&&new Date-Smart.ListBox.DragDrop.StartTime>=300&&(r=!1,Smart.ListBox.DragDrop.StartTime=null),r){const i=e.originalEvent.target.closest("smart-list-box");i?i._pointerUpHandler(e):t._pointerUpHandler(e),Smart.ListBox.DragDrop.StartPosition=null}else{let t=e.originalEvent.target;if(!(e.target instanceof Smart.ListItem)||t.readonly||e.target.disabled||e.target instanceof Smart.ListItemsGroup)for(;t.parentElement;){if(t instanceof Smart.ListItem&&!t.readonly&&!t.disabled&&!(t instanceof Smart.ListItemsGroup)){e.stopPropagation();break}t=t.parentElement}else e.stopPropagation()}}else if(!Smart.Utilities.Core.isMobile&&!Smart.ListBox.DragDrop.Dragging&&"release"===t.selectionChangeAction){const i=(t.shadowRoot||t.isInShadowDOM?e.originalEvent.composedPath()[0]:e.originalEvent.target).closest("smart-list-box");i&&(i.upTimer&&clearTimeout(i.upTimer),t.isInShadowDOM?i?i._pointerUpHandler(e):t._pointerUpHandler(e):i.upTimer=setTimeout((()=>{i?i._pointerUpHandler(e):t._pointerUpHandler(e)})))}if(Smart.ListBox.DragDrop.Feedback){let i;if(Smart.ListBox.DragDrop.Feedback.parentNode&&Smart.ListBox.DragDrop.Feedback.parentNode.removeChild(Smart.ListBox.DragDrop.Feedback),Smart.ListBox.DragDrop.Feedback=null,Smart.Utilities.Core.isMobile&&Smart.ListBox.DragDrop.Dragging)for(let t=0;t<Smart.ListBox.DragDrop.ListBoxes.length;t++){const l=Smart.ListBox.DragDrop.ListBoxes[t],r=l.getBoundingClientRect();if(l.allowDrop&&!l.closest(".smart-visibility-hidden")&&r.left<=e.clientX&&e.clientX<=r.left+r.width&&r.top<=e.clientY&&e.clientY<=r.top+r.height){i=l;const t=l._items.filter((e=>!e.hidden));for(let i=0;i<t.length;i++){const o=t[i],s=o.getBoundingClientRect();if((t.indexOf(o)===t.length-1||o.parentNode.lastElementChild===o)&&e.clientY>=r.top+o.offsetTop-l.scrollTop+s.height/2&&e.clientY<=r.top-l.scrollTop+o.offsetTop+s.height){Smart.ListBox.DragDrop.DropDetails={item:o,position:"bottom"};break}if(e.clientY>=r.top+o.offsetTop-l.scrollTop&&e.clientY<=r.top+o.offsetTop+s.height-l.scrollTop){Smart.ListBox.DragDrop.DropDetails={item:o,position:"top"};break}}}}if(Smart.ListBox.DragDrop.Dragging){if(Smart.ListBox.DragDrop.DropDetails){let l=Smart.ListBox.DragDrop.DropDetails.item,r=Smart.ListBox.DragDrop.Item;const o=r.ownerListBox;let s=e.originalEvent.target;if(t.isInShadowDOM&&(s=e.originalEvent?e.originalEvent.composedPath()[0]:e.composedPath()[0]),i=!i&&s.closest?s.closest("smart-list-box"):i,document.body.classList.remove("smart-dragging"),l.$.removeClass("smart-list-item-line-feedback"),l.$.removeClass("smart-list-item-bottom-line-feedback"),i&&l.ownerListBox!==i&&i.items.length>0&&(l=i.items[i.items.length-1]),Smart.ListBox.DragDrop.Item===l||i!==l.ownerListBox&&!Smart.Utilities.Core.isMobile)i&&0===i._items.length&&"none"!==i.dropAction&&("move"===i.dropAction?Smart.ListBox.DragDrop.Item.ownerListBox.removeChild(Smart.ListBox.DragDrop.Item):"copy"===i.dropAction&&(r=r.cloneNode(!0)),i.appendChild(r));else if("none"!==r.ownerListBox.dropAction){l.ownerListBox!==r.ownerListBox&&"move"===r.ownerListBox.dropAction&&Smart.ListBox.DragDrop.Item.ownerListBox.removeChild(Smart.ListBox.DragDrop.Item),"copy"===r.ownerListBox.dropAction&&(r=r.cloneNode(!0)),Smart.ListBox.DragDrop.Item.group=l.group;const e=l.ownerListBox;"checkBox"!==e.selectionMode&&"radioButton"!==e.selectionMode&&e.clearSelection(),"top"===Smart.ListBox.DragDrop.DropDetails.position?e.insertBefore(r,l):l.parentNode.lastElementChild===l?e.appendChild(r):e.appendChild(r,l),e.ensureVisible(r),"checkBox"===e.selectionMode||"radioButton"===e.selectionMode?(e._focus(r),e._refreshSelection()):(e.clearSelection(),e.select(r))}r.selected&&i!==o&&o._refreshSelection();const n=Smart.ListBox.DragDrop.Item,a=n.ownerListBox;n.displayMode="checkBox"===a.selectionMode||"radioButton"===a.selectionMode?a.selectionMode:"plain",a.$.fireEvent("dragEnd",{item:n,target:l,data:Smart.ListBox.DragDrop,previousContainer:o,container:i,originalEvent:e}),a._focus(n)}else{const t=Smart.ListBox.DragDrop.Item,i=t.ownerListBox;t.displayMode="checkBox"===i.selectionMode||"radioButton"===i.selectionMode?i.selectionMode:"plain",document.body.classList.remove("smart-dragging"),i.$.fireEvent("dragEnd",{item:t,target:null,data:Smart.ListBox.DragDrop,previousContainer:i,container:i,originalEvent:e}),i._focus(t)}e.preventDefault()}delete Smart.ListBox.DragDrop.DraggedFrom,Smart.ListBox.DragDrop.Dragging=!1,Smart.ListBox.DragDrop.Item=null,Smart.ListBox.DragDrop.DropDetails=null}for(let e=0;e<Smart.ListBox.DragDrop.ListBoxes.length;e++){const t=Smart.ListBox.DragDrop.ListBoxes[e];t._dragInterval&&clearInterval(t._dragInterval)}}}_itemsContainerMoveHandler(e){const t=this;if(Smart.ListBox.DragDrop.Dragging)return t._applyItemFeedback(e),t._moveHandler(e),e.originalEvent.preventDefault(),e.originalEvent.stopPropagation(),!1}_touchmoveHandler(e){if(Smart.ListBox.DragDrop.Dragging&&e.cancelable)return e.preventDefault(),void e.stopPropagation();super._touchmoveHandler(e)}_applyItemFeedback(e){const t=this,i=e.originalEvent.target,l=i.closest?i.closest("smart-list-item"):i;Smart.Utilities.Core.isMobile?Smart.ListBox.DragDrop.DropDetails={item:Smart.ListBox.DragDrop.Item,position:"bottom"}:0!==t.items.length&&(l?l._itemOnMouseMove(e):t.items[t.items.length-1]._itemOnMouseMove(e,!0))}_moveHandler(e){const t=this;if(!Smart.ListBox.DragDrop.Feedback||Smart.ListBox.DragDrop.DraggedFrom!==t)return;const i=t.dragOffset;if(Smart.ListBox.DragDrop.Dragging){Smart.ListBox.DragDrop.Feedback.style.left=i[0]+e.pageX+"px",Smart.ListBox.DragDrop.Feedback.style.top=i[1]+e.pageY+"px",t.$.fireEvent("dragging",{item:Smart.ListBox.DragDrop.Item,data:Smart.ListBox.DragDrop,originalEvent:e.originalEvent});for(let t=0;t<Smart.ListBox.DragDrop.ListBoxes.length;t++){const i=Smart.ListBox.DragDrop.ListBoxes[t];i._dragInterval&&clearInterval(i._dragInterval),i._dragInterval=setInterval((function(){const t=i.getBoundingClientRect();t.left<=e.clientX&&t.left+t.width>=e.clientX&&(e.clientY>=t.top&&e.clientY<=t.top+20?i.scrollTop-=2:e.clientY>=t.top+t.height-20&&e.clientY<=t.top+t.height&&(i.scrollTop+=2))}),1)}return e.preventDefault(),e.stopPropagation(),e.originalEvent.preventDefault(),e.originalEvent.stopPropagation(),!1}{const l=Math.abs(e.pageX-Smart.ListBox.DragDrop.StartPosition.left),r=Math.abs(e.pageY-Smart.ListBox.DragDrop.StartPosition.top),o=new Date-Smart.ListBox.DragDrop.StartTime;let s=l>=5&&l<=15||r>=5&&r<=15;if(Smart.Utilities.Core.isMobile&&(o<300||o>1e3)&&(s=!1),s){Smart.ListBox.DragDrop.Dragging=!0,Smart.ListBox.DragDrop.Feedback.style.left=i[0]+e.pageX+"px",Smart.ListBox.DragDrop.Feedback.style.top=i[1]+e.pageY+"px",t.getShadowRootOrBody().appendChild(Smart.ListBox.DragDrop.Feedback),e.preventDefault(),e.stopPropagation(),e.originalEvent.preventDefault(),e.originalEvent.stopPropagation();const l=Smart.ListBox.DragDrop.Item,r=l.ownerListBox;r.$.fireEvent("dragStart",{item:l,data:Smart.ListBox.DragDrop,container:r,previousContainer:r,originalEvent:e.originalEvent}),document.body.classList.add("smart-dragging")}}}_focusHandler(){this._focused=!0,this.setAttribute("focus","")}_blurHandler(){this._focused=!1,this.removeAttribute("focus")}appendChild(e){const t=this;if(!t.isCompleted){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.appendChild.apply(t,e.concat(Array.prototype.slice.call(arguments)))}t.isVirtualized?(t._items.indexOf(e)>-1&&t._items.splice(t._items.indexOf(e),1),t._items.push(e)):(e.dataItem=e,t.shadowRoot&&"light"===t.shadowDomMode?t.appendChild(e):t.$.itemsInnerContainer.appendChild(e),t._items.indexOf(e)>-1&&t._items.splice(t._items.indexOf(e),1),t._items.push(e)),t._isUpdating||(t._refreshItems(),t._refreshSelection())}insertBefore(e,t){const i=this;if(!i.isCompleted){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.insertBefore.apply(i,e.concat(Array.prototype.slice.call(arguments)))}i.isVirtualized?(i._items.indexOf(e)>-1&&i._items.splice(i._items.indexOf(e),1),i._items.splice(i._indexOf(t),0,e)):(e.dataItem=e,t.parentNode.insertBefore(e,t),i._items.indexOf(e)>-1&&i._items.splice(i._items.indexOf(e),1),i._items.splice(i._indexOf(t),0,e)),i._refreshItems(),i._refreshSelection()}removeChild(e){const t=this;if(!t.isCompleted){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.removeChild.apply(t,e.concat(Array.prototype.slice.call(arguments)))}if(t.isVirtualized)t._items.splice(t._indexOf(e),1);else if(e.parentNode){const i=t.selectedIndexes.slice(0),l=t.selectedValues.slice(0),r=i.indexOf(e.dataIndex);e.parentNode.removeChild(e),r>-1&&(i.splice(r,1),l.splice(r,1),t.selectedIndexes=i,t.selectedValues=l)}t._refreshItems()}propertyChangedHandler(e,t,i){if("dataSource"===e&&(!i||i&&Array.isArray(i)&&0===i.length))return void this.clearItems();super.propertyChangedHandler(e,t,i);const l=this;switch(e){case"innerHTML":l.clearSelection(),l._dataBind(),l.innerHTML=l.content=Smart.Utilities.Core.html(l.$.content);break;case"dataSource":case"valueMember":case"groupMember":case"displayMember":l.clearSelection(),l._dataBind(),l._applyDefaultSelection();break;case"disabled":case"unfocusable":l._setFocusable();break;case"displayLoadingIndicator":l._setLoadingIndicatorVisibility();break;case"filterable":l._refreshFilter(),l._refreshLayout();break;case"grouped":if(i?l._group():l._ungroup(),"radioButton"===l.selectionMode){if(l.selectedValues.length>0){const e=l.selectedValues;l.clearSelection(),l.select(e[0])}}else l._refreshSelection();l._refreshLayout();break;case"itemTemplate":{if(null===i||""===i)return l._items.map((e=>e.innerHTML=e.label)),delete l._bindingDetails,void l._refreshLayout();const e=l.querySelectorAll("smart-list-item"),t=function(){l._handleItemTemplate(i)&&(l._items.map((e=>l._applyTemplate(e))),l._refreshLayout()),l.ownerElement&&l.ownerElement._setDropDownSize&&l.ownerElement._setDropDownSize(),l.$.fireEvent("bindingComplete")};0===e.length?t():l._ensureItemsReady(e,t);break}case"selectedIndexes":case"selectedValues":{let r=l.selectedIndexes.slice(0),o=l.selectedValues.slice(0);if(!l._items||0===l._items.length)return l.selectedIndexes=[],l.selectedValues=[],void(l.$.hiddenInput.value=l.selectedValues.toString());if(l._propertyChanging=!0,"selectedIndexes"===e){r=t.slice(0),l.clearSelection();for(let e=0;e<i.length;e++){const t=i[e],r=l._items[t];r&&("oneOrManyExtended"===l.selectionMode||"oneOrMany"===l.selectionMode?(l.selectedIndexes.length>0&&0===e&&l.clearSelection(),l._select(r)):l.select(r))}}else{o=t.slice(0),l.selectedValues=[],l.clearSelection();for(let e=0;e<i.length;e++){const t=i[e],r=l.getItem(t);r&&("oneOrManyExtended"===l.selectionMode?l._select(r):l.select(r))}l._refreshSelectAll()}if(l.selectedIndexes.length>0&&l._focus(l._items[l.selectedIndexes[0]]),l._propertyChanging=!1,JSON.stringify(o)!==JSON.stringify(l.selectedValues.slice(0))){let e=[],t=[];for(let e=0;e<r.length;e++)l.selectedIndexes.indexOf(r[e])<0&&t.push(l._items[r[e]]);for(let t=0;t<l.selectedIndexes.length;t++)r.indexOf(l.selectedIndexes[t])<0&&e.push(l._items[l.selectedIndexes[t]]);let i={addedItems:e,removedItems:t};if(l.selectedIndexes.length>0){const e=l._items[l.selectedIndexes[l.selectedIndexes.length-1]];void 0!==e&&(i.selected=e.selected,i.disabled=e.disabled,i.index=l._indexOf(e),i.label=e.label,i.value=e.value)}else i.selected=!1,i.disabled=!1,i.index=-1,i.label="",i.value="";l.$.fireEvent("change",i),l._updateTargetValue()}break}case"selectionMode":{const e="checkBox"===l.selectionMode||"radioButton"===l.selectionMode?l.selectionMode:"plain",r=l.selectedIndexes.slice(0),o=l.selectedValues.slice(0);l._propertyChanging=!0;const s=l.selectedValues;l.setAttribute("aria-multiselectable",-1!==["oneOrManyExtended","zeroOrMany","oneOrMany","checkBox","radioButton"].indexOf(i)),l.selectedValues=[],l.clearSelection();for(let e=0;e<s.length;e++){const t=s[e],i=l.getItem(t);i&&("oneOrManyExtended"===l.selectionMode?l._select(i):l.select(i))}if(l._items.forEach((t=>t.displayMode=e)),l._recycle(),l._propertyChanging=!1,JSON.stringify(o)!==JSON.stringify(l.selectedValues.slice(0))){let e=[],t=[];for(let e=0;e<r.length;e++)l.selectedIndexes.indexOf(r[e])<0&&t.push(l._items[r[e]]);for(let t=0;t<l.selectedIndexes.length;t++)r.indexOf(l.selectedIndexes[t])<0&&e.push(l._items[l.selectedIndexes[t]]);let i={addedItems:e,removedItems:t};if(r.length>0){const e=l._items[r[r.length-1]];e&&(i.selected=e.selected,i.disabled=e.disabled,i.index=l._indexOf(e),i.label=e.label,i.value=e.value)}l.$.fireEvent("change",i),l._updateTargetValue()}l._applyAriaSelected(),"checkBox"!==i&&"radioButton"!==i&&"checkBox"!==t&&"radioButton"!==t||l._refreshLayout();break}case"topVisibleIndex":l._setTopVisibleIndex(i);break;case"autoSort":l._canSort=i;break;case"alternationStart":case"alternationEnd":case"alternationCount":l._refreshItems(),l._refreshLayout();break;case"sortDirection":case"sorted":{l._canSort=!0,i?l._sort():l._unsort();const e=l.selectedValues;l.selectedValues=[],l._refreshSelection();for(let t=0;t<e.length;t++){const i=e[t],r=l.getItem(i);r&&("oneOrManyExtended"===l.selectionMode?l._select(r):l.select(r))}l._refreshLayout(),l._canSort=l.autoSort;break}}}_refreshSelection(){const e=this;if(!e._items||0===e._items.length)return;const t=e.selectedValues;e.selectedIndexes=[],e.selectedValues=[];for(let i=0;i<e._items.length;i++){const l=e._items[i];l&&"selectAll"===l.value||(l.selected=!1,t.indexOf(l.value)>-1&&e.select(l))}e._recycle()}allChecked(){const e=this;if("checkBox"!==e.selectionMode)return!1;const t=e._filteredItems?e._filteredItems:e._items;if(e.selectAll){for(let e=1;e<t.length;e++)if(!t[e].selected)return!1}else for(let e=0;e<t.length;e++)if(!t[e].selected)return!1;return!0}allUnchecked(){const e=this;if("checkBox"!==e.selectionMode)return!0;const t=e._filteredItems?e._filteredItems:e._items;if(e.selectAll){for(let e=1;e<t.length;e++)if(t[e].selected)return!1}else for(let e=0;e<t.length;e++)if(t[e].selected)return!1;return!0}uncheckAll(e){const t=this;if(e){const i=t.selectedIndexes.slice(0),l=t.selectedValues.slice(0),r=[];for(let r=0;r<t._items.length;r++){const o=t._items[r];if(e){let r=!1;for(let t=0;t<e.length;t++)if(o!==e[t]&&o.value!==e[t]&&o.label!==e[t]||(r=!0),"number"==typeof e[t]&&o.value===e[t]&&(r=!0),"object"==typeof e[t]){const i=e[t];(i.value&&o.value===i.value||i.label&&o.label===i.label)&&(r=!0)}if(r){const e=t._indexOf(o);o.selected=!1,-1!==e&&(i.splice(i.indexOf(e),1),l.splice(l.indexOf(o.value||o.label),1))}}}if(t.selectedIndexes=i,t.selectedValues=l,t._recycle(),t.$.hiddenInput.value=l.toString(),!t.isCompleted||!t.isInitialized||t._propertyChanging)return;let o=[];if(t._previouslySelectedIndexes){for(let e=0;e<t._previouslySelectedIndexes.length;e++)t.selectedIndexes.indexOf(t._previouslySelectedIndexes[e])<0&&o.push(t._items[t._previouslySelectedIndexes[e]]);delete t._previouslySelectedIndexes}t.$.fireEvent("change",{addedItems:r,removedItems:o,selected:!0,disabled:!1,index:i,label:l,value:l}),t._updateTargetValue()}else this.clearSelection()}checkAll(e){const t=this;if("checkBox"!==t.selectionMode)return;const i=t.selectedIndexes.slice(0),l=t.selectedValues.slice(0),r=[];for(let o=0;o<t._items.length;o++){const s=t._items[o];if(e){let t=!1;for(let i=0;i<e.length;i++){if(s===e[i]||s.value===e[i]||s.label===e[i]){t=!0;break}if("number"==typeof e[i]&&s.value===e[i]){t=!0;break}if("object"==typeof e[i]){const l=e[i];if(l.value&&s.value===l.value){t=!0;break}if(l.label&&s.label===l.label){t=!0;break}}}if(!t)continue}const n=t.selectedIndexes.indexOf(t._indexOf(s));s.selected=!0,"selectAll"!==s.value&&(-1===n?(r.push(s),i.push(t._indexOf(s)),l.push(s.value||s.label)):-1===l.indexOf(s.value||s.label)&&l.push(s.value||s.label))}if(t.selectedIndexes=i,t.selectedValues=l,t._recycle(),t._refreshSelectAll(),t.$.hiddenInput.value=l.toString(),!t.isCompleted||!t.isInitialized||t._propertyChanging)return;let o=[];if(t._previouslySelectedIndexes){for(let e=0;e<t._previouslySelectedIndexes.length;e++)t.selectedIndexes.indexOf(t._previouslySelectedIndexes[e])<0&&o.push(t._items[t._previouslySelectedIndexes[e]]);delete t._previouslySelectedIndexes}return t.$.fireEvent("change",{addedItems:r,removedItems:o,selected:!0,disabled:!1,index:i,label:l,value:l}),t._updateTargetValue(),!0}clearSelection(){const e=this;if(!e._items||0===e._items.length)return;let t=[];for(let i=0;i<e._items.length;i++)e._items[i].selected&&t.push(e._items[i]);e._items.map((e=>e.selected=!1)),e.selectedValues.slice(0);const i=e.selectedIndexes.slice(0);if(e.selectedIndexes=[],e.selectedValues=[],e.$.hiddenInput.value=e.selectedValues.toString(),e._recycle(),e.context!==e){let l={addedItems:[],removedItems:t};if(i.length>0){const t=e._items[i[i.length-1]];t&&(l.selected=t.selected,l.disabled=t.disabled,l.index=e._indexOf(t),l.label=t.label,l.value=t.value)}e.$.fireEvent("change",l),e._updateTargetValue()}}ensureVisible(e){const t=this;if(e)return!("string"==typeof e&&!(e=t.getItem(e))||(t.isVirtualized||t.$.itemsContainer.scrollTop===t.scrollTop||(t.scrollTop=t.$.itemsContainer.scrollTop),e.top+e.height>=t.scrollTop+t.offsetHeight&&(t.scrollTop=t.scrollTop+e.height,t.isVirtualized||(t.$.itemsContainer.scrollTop=t.scrollTop)),(e.top<=t.scrollTop||e.top>=t.scrollTop+t.$.itemsContainer.offsetHeight)&&(t.scrollTop=e.top,t.isVirtualized||(t.$.itemsContainer.scrollTop=t.scrollTop)),0===t._indexOf(e)||1===t._indexOf(e)&&t._items.length>1&&t._items[0].grouped?(t.scrollTop=0,t.isVirtualized||(t.$.itemsContainer.scrollTop=t.scrollTop)):t._indexOf(e)===t._items.length-1&&(t.scrollTop=t.scrollHeight,t.isVirtualized||(t.$.itemsContainer.scrollTop=t.scrollTop)),0))}get items(){const e=this;if(!window.__karma__&&!window.karma&&e instanceof Element&&e.isRendered&&e.hasAttribute&&e.hasAttribute("smart-blazor")){let t=[];for(let i=0;i<e._items.length;i++){const l=e._items[i];t.push({label:l.label,value:l.value})}return t}return e._filteredItems?e._filteredItems:e._items}getItems(){const e=this,t=e._filteredItems?e._filteredItems:e._items;let i=[];if(t&&t.length>0)for(let e=0;e<t.length;e++){const l=t[e];"selectAll"!==l.value&&i.push({label:l.label,value:l.value})}return i}ready(){super.ready();const e=this;if(e.shadowRoot&&"light"===e.shadowDomMode){const t=document.createDocumentFragment();[].slice.call(e.$.itemsInnerContainer.children).map((e=>t.appendChild(e))),e.appendChild(t),e.$.itemsInnerContainer.appendChild(document.createElement("slot"))}e._areCSSVarsSupported=Smart.Utilities.Core.CSSVariablesSupport(),e.isUpdating=0,e._scrollView&&(e._scrollView=new Smart.Utilities.Scroll(e,e.$.horizontalScrollBar,e.$.verticalScrollBar),e._scrollView.hScrollBar.$.addClass("smart-hidden"),e._scrollView.vScrollBar.$.addClass("smart-hidden"));const t=e._scrollView.vScrollBar,i=e._scrollView.hScrollBar;t.hasStyleObserver=!1,i.hasStyleObserver=!1,t.hasResizeObserver=!1,i.hasResizeObserver=!1,t.wait=!1,i.wait=!1,e._setFocusable()}render(){const e=this;e.$.itemsInnerContainer.setAttribute("role","listbox"),e.$.itemsInnerContainer.setAttribute("aria-label","List Box Items Container"),e.$.itemsInnerContainer.setAttribute("aria-orientation","vertical"),e.$.verticalScrollBar.setAttribute("aria-controls",e.id),e.$.horizontalScrollBar.setAttribute("aria-controls",e.id),e._keysPressed={},e._incrementalSearchQuery="",e._incrementalSearchItems=[],e._canSort=!0,e._previousEntry="",e._setLoadingIndicatorVisibility(),e._refreshFilter(),e._initializeInnerHTML(),e._dataBind(),e._applyDefaultSelection(),e.enableShadowDOM&&HTMLElement.prototype.appendChild.apply(e,[e.$.hiddenInput]),e.$.itemsInnerContainer.setAttribute("aria-multiselectable",-1!==["oneOrManyExtended","zeroOrMany","oneOrMany","checkBox","radioButton"].indexOf(e.selectionMode)),e.setAttribute("aria-label","List Box"),super.render()}_lazyInitItems(){const e=this;if(e._inLazyInit)return cancelAnimationFrame(Smart.ListBox.processTimer),void delete Smart.ListBox.processTimer;e._inLazyInit=!0,e.dataSource||(e.clearSelection(),e._dataBind(),e._applyDefaultSelection()),cancelAnimationFrame(Smart.ListBox.processTimer),delete Smart.ListBox.processTimer,e._inLazyInit=!1}_applyDefaultSelection(){const e=this;!e._focusedItem&&e._items&&e._items.length>0&&0===e.selectedIndexes.length&&("one"!==e.selectionMode&&"oneOrMany"!==e.selectionMode&&"oneOrManyExtended"!==e.selectionMode||e.select(e._items[0]))}attached(){const e=this;super.attached(),Smart.ListBox.DragDrop||(Smart.ListBox.DragDrop={ListBoxes:[]}),Smart.ListBox.DragDrop.ListBoxes.push(e),e._scrollView||(e._scrollView=new Smart.Utilities.Scroll(e,e.$.horizontalScrollBar,e.$.verticalScrollBar)),e.selectedIndexes.length>0&&e._items&&e.ensureVisible(e._items[e.selectedIndexes[0]])}detached(){const e=this;if(super.detached(),e._scrollView&&(e._scrollView.unlisten(),delete e._scrollView),Smart.ListBox.DragDrop&&Smart.ListBox.DragDrop.ListBoxes){const t=Smart.ListBox.DragDrop.ListBoxes.indexOf(e);Smart.ListBox.DragDrop.ListBoxes.splice(t,1)}}_createItem(e,t,i){const l=this,r="checkBox"===l.selectionMode||"radioButton"===l.selectionMode?l.selectionMode:"plain",o=i?{}:document.createElement("smart-list-item");o.ownerListBox=l,"number"==typeof e&&(e=""+e);const s=function(t,i){return void 0!==e[t]?""+e[t]:e[i]};let n="string"==typeof e?e:s(l.displayMember,"label"),a="string"==typeof e?e:s(l.valueMember,"value"),d=s(l.groupMember,"group");return void 0===n&&(n=void 0!==t?""+t:""),o.label=o.innerHTML=""+n,void 0===a&&(a=void 0!==t?""+t:n),e.color&&(o.color=e.color),o.value=""+a,o.displayMode=r,o.selected=!!e.selected&&e.selected,o.disabled=!!e.disabled&&e.disabled,o.dataItem=o,void 0!==t&&(o.dataIndex=t),l._alternateItem(o),e.title&&(o.title=e.title),d&&(o.group=""+d),o}_alternateItem(e){const t=this,i=t.alternationStart,l=t.alternationEnd>0?t.alternationEnd:1/0;t.alternationCount<=0||(void 0===t._alternationIndexCounter&&(t._alternationIndexCounter=0),e.dataIndex>=i&&e.dataIndex<=l&&(e.alternationIndex=t._alternationIndexCounter++,t._alternationIndexCounter===t.alternationCount&&(t._alternationIndexCounter=0)))}_beginUpdate(){this.isUpdating++}_isUpdating(){return this.isUpdating>0}_endUpdate(){this.isUpdating--}get _scrollHeight(){const e=this;if(0===e._items.length||e._items.filter((e=>!e.hidden)).length<1)return 0;let t=0;if(e.isVirtualized){if(e.__scrollHeight)return e.__scrollHeight;if(0===e._items.length)return 0;e.isUpdating++;const i=e._createItem(e._items[0]);e.$.itemsInnerContainer.appendChild(i);for(let l=0;l<e._items.length;l++){const r=e._items[l];r.hidden?(r.height=0,r.top=t):(e.itemHeight?(e.itemHeight<32&&(e.itemHeight=32),r.height=e.itemHeight):(i.$&&i.$.itemContainer?i.$.itemContainer.firstElementChild.innerHTML=r.label:i.label=r.label,r.height=i.offsetHeight),r.top=t,t+=r.height)}e.$.itemsInnerContainer.removeChild(i),e.__scrollHeight=t-e.$.itemsInnerContainer.offsetHeight,e.filterable,t=e.__scrollHeight,e.isUpdating--}else{for(let i=0;i<e._items.length;i++){const l=e._items[i];l.hidden?(l.height=0,l.top=t):(e.itemHeight?"auto"!==e.itemHeight&&(l.height=e.itemHeight,l.style.height=l.height+"px"):l.height=l.offsetHeight,l.top=l.offsetTop,t+=l.height)}t=e.$.itemsInnerContainer.scrollHeight-e.$.itemsInnerContainer.offsetHeight,e.filterable&&t>0&&(t+=e.$.filterInput.offsetHeight),e.__scrollHeight=t}return t}_initializeRecyclingItems(){const e=this;if(!e.dataSource||e.dataSource&&0===e.dataSource.length||!e.isVirtualized)return;let t=0,i=e.offsetHeight||400;e.$.itemsInnerContainer.innerHTML="",e._recyclingItems=[];const l=function(l){for(let r=0;r<l.length;r++){const o=l[r],s=e._createItem(o);if(e.itemHeight&&"auto"!==e.itemHeight&&(s.style.height=e.itemHeight+"px"),e.$.itemsInnerContainer.appendChild(s),t+=s.offsetHeight,s.dataItem=e._items[r],e._recyclingItems.push(s),t>1.5*i)break}};if("function"==typeof e.dataSource){let e=[];for(let t=0;t<100;t++)e.push("");l(e)}else{l(e.dataSource);let r=0;for(;t<1.5*i&&++r<5;)l(e.dataSource)}}dataBind(){const e=this;e.clearSelection(),e._dataBind(),e._applyDefaultSelection()}_dataBind(){const e=this;if(e._scrollView||(e._scrollView=new Smart.Utilities.Scroll(e,e.$.horizontalScrollBar,e.$.verticalScrollBar)),"function"==typeof e.dataSource){e._items=[],delete e._filteredItems;const t=e.dataSource("",(t=>{e.clearItems(),e.insert(0,t)}));t&&Array.isArray(t)&&(e.clearItems(),e.insert(0,t))}if("string"==typeof e.dataSource&&(e.dataSource=JSON.parse(e.dataSource)),null!==e.dataSource&&Array.isArray(e.dataSource)){e.isUpdating++;const t=t=>{e._items=[],e._groups=[],delete e._filteredItems;let i=e.dataSource;"checkBox"===e.selectionMode&&e.selectAll&&(i=[e._createItem({label:e.localize("selectAll"),value:"selectAll"})].concat(e.dataSource));for(let l=0;l<i.length;l++){const r=i[l],o=e._createItem(r,l,!t);e._items[l]=o,t&&t.appendChild(o)}};if(e.isVirtualized)t(),e._initializeRecyclingItems();else{const i=document.createDocumentFragment();e.$.itemsInnerContainer.innerHTML="",t(i),e.$.itemsInnerContainer.appendChild(i)}e.isUpdating--}const t=e.shadowRoot?e.shadowRoot.querySelectorAll("smart-list-item"):e.querySelectorAll("smart-list-item"),i=function(){e.isUpdating++,e.dataSource||(e._initializeHtmlListItems(),e._initializeHtmlListGroups()),e.grouped&&e._group(),e.sorted&&e._sort(),e._refreshLayout(),e._initializeSelection(),e.isInitialized=!0,e._canSort=e.autoSort,e.isUpdating--,e.itemTemplate&&e._handleItemTemplate(e.itemTemplate)&&(e._items.map((t=>e._applyTemplate(t))),e._refreshLayout()),e.__onCompleted&&(e._onCompleted=e.__onCompleted,e.__onCompleted=null,e._onCompleted()),e.topVisibleIndex>-1&&e._setTopVisibleIndex(e.topVisibleIndex),e.$.fireEvent("bindingComplete"),e._updateTopVisibleIndex(),0===e._items.length&&e.clearItems(),e._applyAriaSelected()};0===t.length?i():(e._onCompleted&&(e.__onCompleted=e._onCompleted,e._onCompleted=null),e._ensureItemsReady(t,i))}_ensureItemsReady(e,t){const i=this,l=function(){const i=function(t){for(let i=0;i<e.length;i++)e[i].context="node"===t?e[i]:document};i("node"),t(),i()};if(0===e.length)l();else{i._nodesReadyListeners=0;for(let t=0;t<e.length;t++){const r=e[t],o=function(){i._nodesReadyListeners--,0===i._nodesReadyListeners&&(l(),delete i._nodesReadyListeners)}.bind(i);r.isCompleted||(i._nodesReadyListeners++,r._onCompleted=o)}0===i._nodesReadyListeners&&l()}}_initializeInnerHTML(){const e=this;e.$.itemsInnerContainer.innerHTML.indexOf("<option")>=0?e.$.itemsInnerContainer.innerHTML=e.$.itemsInnerContainer.innerHTML.replace(/<optgroup/gi,"<smart-list-items-group").replace(/<\/optgroup/gi,"</smart-list-items-group").replace(/<option/gi,"<smart-list-item").replace(/<\/option/gi,"</smart-list-item"):e.$.itemsInnerContainer.innerHTML.indexOf("<ul")>=0&&(e.$.itemsInnerContainer.innerHTML=e.$.itemsInnerContainer.innerHTML.replace(/<ul/gi,"<smart-list-items-group").replace(/<\/ul/gi,"</smart-list-items-group").replace(/<li/gi,"<smart-list-item").replace(/<\/li/gi,"</smart-list-item"))}_initializeHtmlListItems(){const e=this,t=e.shadowRoot&&"shadow"===e.shadowDomMode?e.shadowRoot.querySelectorAll("smart-list-item"):e.querySelectorAll("smart-list-item"),i="checkBox"===e.selectionMode||"radioButton"===e.selectionMode?e.selectionMode:"plain",l=function(e,t,i){return void 0!==e[t]?""+e[t]:e[i]};e._items=[];let r=0;for(let o=0;o<t.length;o++){const s=t[o];s.dataIndex=o,s.label=s.innerHTML,s.dataItem=s,s.top||(s.top=r),s.height||(s.height=s.offsetHeight),r+=s.height,s.value||(s.value=""+o);const n=l(s,e.displayMember,"label"),a=l(s,e.valueMember,"value"),d=l(s,e.groupMember,"group");s.label!==n&&(s.label=n),s.value!==a&&(s.value=a),s.group!==d&&(s.group=d);const c=s.context;s.context=document,s.displayMode=i,s.context=c,e._alternateItem(s),s.selected&&"selectAll"!==s.value&&(e.selectedIndexes.push(o),e.selectedValues.push(s.value)),e._items.push(s)}e.itemTemplate&&e._handleItemTemplate(e.itemTemplate)&&e._items.map((t=>e._applyTemplate(t)))}_group(){const e=this;e.isUpdating++;let t=[],i=[];e._canSort&&e._unsort();for(let i=0;i<e._items.length;i++){const l=e._items[i];let r=l.group?l.group.trim():l.innerHTML.charAt(0)||l.label.charAt(0);r+=" ",t[r]?t[r].items.push(l):t[t.length++]=t[r]={items:[l],label:r}}if(e.isVirtualized){e._groups=[];for(let e=0;e<t.length;e++){const l=t[e];l.dataIndex=e,l.grouped=!0,l.hidden=!1,l.displayMode="plain",i.push(l);for(let r=0;r<t[e].items.length;r++){const e=l.items[r];e.group=l,i.push(e)}}e._groups=t,e._items=i}else{for(;e.$.itemsInnerContainer.firstChild;)e.$.itemsInnerContainer.removeChild(e.$.itemsInnerContainer.firstChild);const l=document.createDocumentFragment();e._groups=[];for(let r=0;r<t.length;r++){const o=t[r],s=document.createElement("smart-list-items-group");s.label=o.label,s.dataIndex=r;for(let e=0;e<t[r].items.length;e++){const t=o.items[e];i.push(t),t.group=o.label,s.appendChild(t)}e._groups.push(s),l.appendChild(s)}e._items=i,/Trident|Edge/.test(navigator.userAgent)?setTimeout((function(){e.$.itemsInnerContainer.appendChild(l)}),50):e.$.itemsInnerContainer.appendChild(l)}e.sorted&&e._sort(),e.isUpdating--}_ungroup(){const e=this;e.isUpdating++,e._groups=[],e._canSort&&e._unsort();let t=[];if(e.isVirtualized)for(let i=0;i<e._items.length;i++){const l=e._items[i];l.grouped||t.push(l)}else{const i=document.createDocumentFragment();for(let l=0;l<e._items.length;l++){const r=e._items[l];i.appendChild(r),t.push(r)}t.length>0&&(e.$.itemsInnerContainer.innerHTML="",e.$.itemsInnerContainer.appendChild(i))}e._items=t,e.sorted&&e._sort(),e.isUpdating--}_initializeHtmlListGroups(){const e=this,t=e.$.itemsInnerContainer.querySelectorAll("smart-list-items-group");e._groups=[];for(let i=0;i<t.length;i++){const l=t[i];l.dataIndex=i,e._groups.push(l)}}_initializeSelection(){const e=this,t=e.selectedIndexes.slice(0),i=e.selectedValues.slice(0);e.clearSelection(),"oneOrManyExtended"===e.selectionMode&&(e._keysPressed.Control=!0);for(let l=0;l<e._items.length;l++){const r=e._items[l];(t.indexOf(l)>=0||i.indexOf(r.value||r.label)>=0)&&(e._focusedItem&&(e._focusedItem._focused=!1),e._focusedItem=null,e.select(r))}"oneOrManyExtended"===e.selectionMode&&(e._keysPressed.Control=!1)}onItemUpdated(){const e=this;e.isInitialized&&!e._isUpdating()&&(e.isUpdating++,e._refreshLayout(),e.isUpdating--)}_refreshItems(){const e=this;if(e.isInitialized&&!e._isUpdating()){if(e.isUpdating++,e.grouped?e._ungroup():e.sorted&&e._canSort&&e._unsort(),!e.isVirtualized){e._items=[];const t=e.shadowRoot?e.shadowRoot.querySelectorAll("smart-list-item"):e.querySelectorAll("smart-list-item");for(let i=0;i<t.length;i++)t[i].dataIndex=i,e._alternateItem(t[i]),e._items.push(t[i])}e.grouped?e._group():e.sorted&&e._sort(),e._refreshLayout(),e.isUpdating--}}_applyIncrementalSearch(e){const t=this;null===t.incrementalSearchDelay||isNaN(t.incrementalSearchDelay)||["Shift","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Control","Home","End","PageUp","PageDown"].indexOf(e)>-1||(0!==t._incrementalSearchQuery.indexOf(e)&&(t._incrementalSearchQuery+=e),t._incrementalSearchTimer&&clearTimeout(t._incrementalSearchTimer),t._incrementalSearch(),t._incrementalSearchTimer=setTimeout((function(){t._incrementalSearchQuery=""}),t.incrementalSearchDelay))}select(e){const t=this;if(!e&&t._items&&(e=t._items[0]),("string"!=typeof e||(e=t.getItem(e)))&&("number"!=typeof e||(e=t.getItem(e)))&&!(e.grouped||e.readonly||!t._items.length||e instanceof HTMLElement&&!t.contains(e)&&!t.virtualized)){if("none"===t.selectionMode)return t.selectedIndexes=[],void(t.selectedValues=[]);switch(!t._focusedItem!==e&&"none"!==t.selectionMode&&(t._focusedItem&&(t._focusedItem._focused=!1),t._focusedItem=e,e._focused=!0),t.selectionMode){case"one":case"zeroAndOne":return(1!==t.selectedIndexes.length||t.selectedIndexes[0]!==t._indexOf(e))&&(t._previouslySelectedIndexes=t.selectedIndexes,t.selectedIndexes.length>=1&&t.clearSelection(),t._select(e),delete t._previouslySelectedIndexes,!0);case"zeroOrOne":return 1===t.selectedIndexes.length&&t.selectedIndexes[0]===t._indexOf(e)?(t.unselect(e),!0):(t._previouslySelectedIndexes=t.selectedIndexes,t.selectedIndexes.length>=1&&t.clearSelection(),t._select(e),delete t._previouslySelectedIndexes,!0);case"radioButton":if(t._previouslySelectedIndexes=t.selectedIndexes,t.$.itemsInnerContainer.querySelectorAll("smart-list-items-group").length>0){const i=e.parentNode;if(!e.selected){for(let e in i.children){const l=i.children[e];l.selected&&t.unselect(l)}t._select(e)}return delete t._previouslySelectedIndexes,!0}if(t.isVirtualized&&t._groups.length>0){const i=e.group;if(!e.selected){for(let e in i.items){const l=i.items[e];l.selected&&t.unselect(l)}t._select(e)}return delete t._previouslySelectedIndexes,!0}return e.selected||(t.selectedIndexes.length>=1&&t.clearSelection(),t._select(e)),delete t._previouslySelectedIndexes,!0;case"oneOrMany":return e.selected?t.selectedIndexes.length>1&&t.unselect(e):t._select(e),!0;case"zeroOrMany":case"checkBox":return e.selected?t.unselect(e):t._select(e),!0;case"oneOrManyExtended":{const i=t.selectedValues;if(t._keysPressed.Control)return t.selectedIndexes.length>1&&e.selected?(t.unselect(e),t._focus(t._items[t.selectedIndexes[0]])):t._select(e),!0;if(t._keysPressed.Shift){const l=t._items[t.selectedIndexes[0]];let r;t.clearSelection();const o=i.indexOf(l.value)>=0||l.selected;if(t._select(l,o),t._indexOf(l)>t._indexOf(e))for(r=t._indexOf(l)-1;r>=t._indexOf(e);){const e=t._items[r],l=i.indexOf(e.value)>=0||e.selected;t._select(e,l),r--}else for(r=t._indexOf(l)+1;r<=t._indexOf(e);){const e=t._items[r],l=i.indexOf(e.value)>=0||e.selected;t._select(e,l),r++}const s=[];for(let e=0;e<i.length;e++)s.push(t.getItem(i[e]));if(s.length>0&&!t._propertyChanging){let l=[];for(let e=0;e<t.selectedValues.length;e++){const r=t.selectedValues[e];i.indexOf(r)<0&&l.push(t.getItem(r))}t.$.fireEvent("change",{addedItems:l,removedItems:s,selected:e.selected,disabled:e.disabled,index:t._indexOf(e),label:e.label,value:e.value}),t._updateTargetValue()}return!0}for(let l=0;l<i.length;l++){const r=i[l],o=t.getItem(r);e!==o&&t.unselect(o)}return t.clearSelection(),t._select(e,i.indexOf(e.value)>=0),!0}}return!1}}_applyTemplate(e,t){const i=this;if(null===i.itemTemplate)return;if("function"==typeof i.itemTemplate)return void i.itemTemplate(e,{label:e.label,value:e.value,index:i._items.indexOf(e)});if(!i._bindingDetails||0===i._bindingDetails.length)return;const l=i._bindingDetails.length;let r,o,s=document.importNode(i._template.content,!0);for(let t=0;t<l;t++){r=s.childNodes[i._bindingDetails[t].childNodeIndex],o=i._bindingDetails[t].bindingString.length;for(let l=0;l<o;l++){const o=i._bindingDetails[t].bindingString[l],s=o.indexOf("label")>=0?e.label:e.value;r.innerHTML=r.innerHTML.replace(o,s)}}e.innerHTML="";for(let t=0;t<s.childNodes.length;t++)s.childNodes[t].outerHTML&&(e.innerHTML+=s.childNodes[t].outerHTML);!1!==t&&(i._scrollHeightTimer&&(clearInterval(i._scrollHeightTimer),i._scrollHeightCounter=0),i._scrollHeightTimer=setInterval((function(){i._lastScrollHeight===i.$.itemsInnerContainer.scrollHeight&&10!==i._scrollHeightCounter||(i._refreshLayout(),clearInterval(i._scrollHeightTimer)),i._lastScrollHeight=i.$.itemsInnerContainer.scrollHeight,i._scrollHeightCounter++}),50))}_refreshSelectAll(){const e=this;if(e.selectAll&&"checkBox"===e.selectionMode&&e._items&&e._items.length>0){let t=e._filteredItems?e._filteredItems:e._items;if(e.$.filterInput.value||(t=e._items),!t[0])return;e.allChecked()?(t[0].indeterminate=!1,t[0].selected=!0):e.allUnchecked()?(t[0].indeterminate=!1,t[0].selected=!1):(t[0].selected=!1,t[0].indeterminate=!0)}}_filterItems(e,t,i){const l=this,r=l.$.filterInput.value;let o,s;const n=function(){if(0===s.length)return l._filteredItems=[],void(t&&t());o=l._queryItems(r,l.filterMode),l._items&&l._items.length&&o.length>0&&"checkBox"===l.selectionMode&&l.selectAll&&o.indexOf(l._items[0])<0&&(o=[l._items[0]].concat(o));for(let e=0;e<s.length;e++)s[e].hidden=!0,s[e].$&&s[e].$.addClass("smart-hidden");for(let e=0;e<o.length;e++){const t=o[e];t.hidden=!1,t.$&&t.$.removeClass("smart-hidden")}if(l.grouped&&l.isVirtualized)for(let e=0;e<l._groups.length;e++){const t=l._groups[e],i=t.items;let r=!0;for(let e=0;e<i.length;e++)i[e].hidden||(r=!1);r&&(t.hidden=!0)}if(l.grouped&&!l.isVirtualized)for(let e=0;e<l._groups.length;e++){const t=l._groups[e],i=[].concat(...t.querySelectorAll("smart-list-item"));let r=!0;for(let e=0;e<i.length;e++)i[e].$.hasClass("smart-hidden")||(r=!1);r?t.$.addClass("smart-hidden"):t.$.removeClass("smart-hidden")}if(l._filteredItems=o,l._refreshSelectAll(),l._refreshLayout(),t&&t(),e)return;const i=l._propertyChanging;l._propertyChanging=!0,l._refreshSelection(),l._propertyChanging=i};if("function"==typeof l.dataSource)if(r||i){const e=function(e){(r||i)&&l.isAttached&&(l._updateListBoxAfterQuery=function(){o=s=l._items,n()},l.clearItems(),l.insert(0,e))},t=l.dataSource(r,e);if(t){if(!r&&!i)return;l._updateListBoxAfterQuery=function(){o=s=l._items,n()},l.clearItems(),l.insert(0,t)}}else l.clearItems(),o=s=l._items,n(),l.$.fireEvent("bindingComplete");else{if(s=l._items,0===s.length)return;n()}}_getNextItem(e){const t=this._items,i=this._items.length;let l=Math.max(e+1,0);for(;l<i;){const e=t[l];if(!(e.disabled||e.hidden||e.grouped||e.readonly))return e;l++}return t[e]}_getPreviousItem(e){const t=this._items;let i=Math.max(e-1,0);for(;i>-1;){const e=t[i];if(!(e.disabled||e.hidden||e.grouped||e.readonly))return e;i--}return t[e]}get _scrollWidth(){const e=this,t=e._items;return e.__scrollWidth||(e.__scrollWidth=(()=>{const e=this,i=e.virtualized,l=e.itemMeasureMode;let r=0,o="";function s(t){const i=e._createItem({label:t});i.style.position="absolute",e.$.itemsContainer.appendChild(i),i.label=t,i.style.width="auto",i.isCompleted&&(i.$.itemContainer.style.width="auto");const l=getComputedStyle(i),r=parseInt(l.paddingLeft)+parseInt(l.paddingRight),o=i.$.itemContainer||i,s=o.offsetWidth+o.offsetLeft+r;return i.parentNode.removeChild(i),s}for(let e=0;e<t.length;e++){const n=t[e];if(!n.hidden)if("auto"===l){const e=i?n.label:n.textContent.trim();e.length>o.length&&(o=e)}else r=Math.max(r,s(n.label))}return"auto"===l?s(o):r})()),e.__scrollWidth}update(e,t){const i=this,l=i._items[e];if(l){if("string"==typeof t)l.label=t,void 0===l.value&&(l.value=t);else for(let e in t)"selected"===e&&l[e]!==t[e]?i.select(l):l[e]=t[e],"group"===e&&i._refreshItems();(i.sorted||i.grouped||i.isVirtualized)&&(i._refreshItems(),i._refreshSelection())}else i.error(i.localize("indexOutOfBound",{elementType:i.nodeName.toLowerCase(),method:"update"}))}insert(e,t){const i=this;let l=[];if((!e||e<0)&&(e=0),Array.isArray(t)){i.isUpdating++;const r=0===i._items.length;for(let o=0;o<t.length;o++){const s=t[o],n=i._createItem(s);l.push(n),e>=i._items.length||0===i._items.length||r?i.appendChild(n):i.insertBefore(n,i._items[e])}i.isUpdating--}else{const r=i._createItem(t);l.push(r),e>=i._items.length||0===i._items.length?i.appendChild(r):i.insertBefore(r,i._items[e])}if(l.length>0?(l.map((e=>i._applyTemplate(e))),i._ensureItemsReady(l,(function(){i._refreshItems(),0!==i._items.length&&(i._updateListBoxAfterQuery&&(i._updateListBoxAfterQuery(),delete i._updateListBoxAfterQuery),i._refreshSelection(),i.$.fireEvent("bindingComplete"))}))):i._updateListBoxAfterQuery&&(i._updateListBoxAfterQuery(),delete i._updateListBoxAfterQuery),i.virtualized&&i.filterable){const e=i.context;i.context=i,i.filterable&&(i.$.filterInput.value="",i._filterItems()),i.scrollTop=i.$.itemsContainer.scrollTop=0,i.scrollLeft=i.$.itemsContainer.scrollLeft=i._getScrollLeft(0),i.context=e}}getSelectedValues(){return this.selectedValues.slice()}add(e){const t=this;let i=[];if(e&&(!e||0!==e.length)){if(Array.isArray(e)){t.isUpdating++;for(let l=0;l<e.length;l++){const r=e[l],o=t._createItem(r);i.push(o),t.appendChild(o)}t.isUpdating--}else{const l=t._createItem(e);i.push(l),t.appendChild(l)}if(i.length>0?(i.map((e=>t._applyTemplate(e))),t._ensureItemsReady(i,(function(){t._refreshItems(),0!==t._items.length&&(t._updateListBoxAfterQuery&&(t._updateListBoxAfterQuery(),delete t._updateListBoxAfterQuery),t._refreshSelection(),t.$.fireEvent("bindingComplete"))}))):t._updateListBoxAfterQuery&&(t._updateListBoxAfterQuery(),delete t._updateListBoxAfterQuery),t.virtualized&&t.filterable){const e=t.context;t.context=t,t.filterable&&(t.$.filterInput.value="",t._filterItems()),t.scrollTop=t.$.itemsContainer.scrollTop=0,t.scrollLeft=t.$.itemsContainer.scrollLeft=t._getScrollLeft(0),t.context=e}else t.virtualized&&t._refreshLayout()}}removeItem(e){const t=this,i=t.getItem(e);if(i){if(i.selected&&t.unselect(i),t.isVirtualized){let e=t._items.indexOf(i);-1===e&&(e=t._items.indexOf(i)),t._items.splice(e,1)}else{i.parentNode.removeChild(i);let e=t._items.indexOf(i);-1===e&&(e=t._items.indexOf(i)),t._items.splice(e,1)}t._refreshItems(),t._refreshSelection(),0===t.selectedIndexes.length&&t._items.length>0&&("oneOrMany"!==t.selectionMode&&"one"!==t.selectionMode&&"oneOrManyExtended"!==t.selectionMode||t.select(t._items[0]))}}removeAt(e){const t=this,i=t._items[e];i?(i.selected&&t.unselect(i),t.isVirtualized||i.parentNode.removeChild(i),t._items.splice(e,1),t._refreshItems(),t._refreshSelection(),0===t.selectedIndexes.length&&t._items.length>0&&("oneOrMany"!==t.selectionMode&&"one"!==t.selectionMode&&"oneOrManyExtended"!==t.selectionMode||t.select(t._items[0]))):t.error(t.localize("indexOutOfBound",{elementType:t.nodeName.toLowerCase(),method:"remove"}))}_queryItems(e,t){const i=this,l=[],r=function(l,r){if(l.grouped)return l;switch(t){case"startsWith":if(0===l.label.indexOf(r))return l;break;case"startsWithIgnoreCase":if(0===l.label.toLowerCase().indexOf(r.toLowerCase()))return l;break;case"doesNotContain":if(l.label.indexOf(r)<0)return l;break;case"doesNotContainIgnoreCase":if(l.label.toLowerCase().indexOf(r.toLowerCase())<0)return l;break;case"contains":if(l.label.indexOf(r)>-1)return l;break;case"containsIgnoreCase":if(l.label.toLowerCase().indexOf(r.toLowerCase())>-1)return l;break;case"equals":if(0===l.label.localeCompare(r))return l;break;case"equalsIgnoreCase":if(0===l.label.toLowerCase().localeCompare(r.toLowerCase()))return l;break;case"endsWith":if(l.label.endsWith(r))return l;break;case"endsWithIgnoreCase":if(l.label.toLowerCase().endsWith(r.toLowerCase()))return l;break;case"custom":if(i.filterCallback(l,e))return l}return null};if(0===(e=""+e).length)return i._items;for(let t=0;t<i._items.length;t++){const o=r(i._items[t],e);o&&l.push(o)}return l}_select(e,t){const i=this,l=i.selectedIndexes.indexOf(i._indexOf(e)),r=i.selectedIndexes.slice(0),o=i.selectedValues.slice(0);if(e.selected=!0,e&&"selectAll"===e.value&&"checkBox"===i.selectionMode&&i.selectAll)return-1===l&&(r.push(i._indexOf(e)),i.selectedIndexes=r),i._recycle(),!1;if(-1!==l)return i._recycle(),!1;if(r.push(i._indexOf(e)),o.push(e.value||e.label),i.selectedIndexes=r,i.selectedValues=o,i._recycle(),i.$.hiddenInput.value=o.toString(),!i.isCompleted||t||!i.isInitialized||i._propertyChanging)return;let s=[];if(i._previouslySelectedIndexes){for(let e=0;e<i._previouslySelectedIndexes.length;e++)i.selectedIndexes.indexOf(i._previouslySelectedIndexes[e])<0&&s.push(i._items[i._previouslySelectedIndexes[e]]);delete i._previouslySelectedIndexes}return i.$.fireEvent("change",{addedItems:[e],removedItems:s,selected:e.selected,disabled:e.disabled,index:i._indexOf(e),label:e.label,value:e.value}),i._updateTargetValue(),i._refreshSelectAll(),!0}_updateTargetValue(){const e=this;if(e.dataset.target){const t=document.querySelector(e.dataset.target);if(t){const i=e.dataset.property,l=e.value;i&&void 0!==t[i]&&(t[i]=l)}}}_setTopVisibleIndex(e){const t=this;if("number"==typeof e&&(t.topVisibleIndex=Math.max(0,e),e=t._items[t.topVisibleIndex]),!e)return!1;e.top!==t.scrollTop&&(t.scrollTop=e.top,t.isVirtualized||(t.$.itemsContainer.scrollTop=t.scrollTop),t.scrollHeight===t.scrollTop&&t._updateTopVisibleIndex())}_updateTopVisibleIndex(){const e=this,t=e.scrollTop+e._scrollView.verticalScrollBar.offsetHeight-e.offsetHeight;let i;if(e.scrollTop<e.scrollHeight/2){for(let l=0;l<e._items.length;l++)if(e._items[l].top>=t){i=e._items[l];break}}else for(let l=e._items.length-1;l>=0&&!(e._items[l].top<t);l--)i=e._items[l];if(i){const t=e.context;e.context=e,e.topVisibleIndex=i.dataIndex,e.context=t}}unselect(e){const t=this;if(!e)return void t.clearSelection();if("string"==typeof e&&!(e=t.getItem(e)))return;if("none"===t.selectionMode)return void t.clearSelection();const i=t.selectedIndexes.indexOf(t._indexOf(e)),l=t.selectedIndexes.slice(0),r=t.selectedValues.slice(0);return e.selected=!1,i>=0&&(l.splice(i,1),r.splice(i,1),t.selectedIndexes=l,t.selectedValues=r,t.$.hiddenInput.value=r.toString(),t.isCompleted&&!t._propertyChanging?(t.$.fireEvent("change",{addedItems:[],removedItems:[e],selected:e.selected,disabled:e.disabled,index:t._indexOf(e),label:e.label,value:e.value}),t._updateTargetValue(),t._recycle(),"selectAll"!==e.value&&t._refreshSelectAll(),!0):void 0)}_handleItemTemplate(e){if(null===e||!e)return;if("function"==typeof e)return e;const t=this;if(!("content"in document.createElement("template")))return t.error(t.localize("htmlTemplateNotSuported",{elementType:t.nodeName.toLowerCase()})),void(t.itemTemplate=null);if(null===(e=document.getElementById(e))||!("content"in e))return t.error(t.localize("invalidTemplate",{elementType:t.nodeName.toLowerCase(),property:"itemTemplate"})),void(t.itemTemplate=null);const i=e.content,l=i.childNodes.length,r=/{{\w+}}/g;let o,s;t._bindingDetails=[],t._template=e;for(let e=0;e<l;e++){for(s=[];o=r.exec(i.childNodes[e].innerHTML);)s.push(o[0]);s.length>0&&t._bindingDetails.push({childNodeIndex:e,bindingString:s})}return!0}_handleKeyStrokes(e){const t=this,i="radioButton"===t.selectionMode||"checkBox"===t.selectionMode||"zeroOrMany"===t.selectionMode||"oneOrMany"===t.selectionMode||"zeroOrOne"===t.selectionMode;let l=t._items;if(t.filterable&&t.$.filterInput.value.length>0&&(l=t._filteredItems),!t.disabled&&!t.readonly&&l.length){switch(e){case"ArrowLeft":case"ArrowUp":t._handleArrowKeys(!0);break;case"ArrowRight":case"ArrowDown":t._handleArrowKeys(!1);break;case" ":{if(t.selectedIndexes.length<1&&!t._focusedItem)return;const e=t._focusedItem?t._focusedItem:t._items[t.selectedIndexes[t.selectedIndexes.length-1]],i=e=>{e.selected&&"radioButton"!==t.selectionMode?t.unselect(e):t.select(e)};if("oneOrMany"===t.selectionMode)return void(e.selected&&t.selectedIndexes.length>1?i(e):e.selected||i(e));i(e);break}case"Home":if(0===l.length)return;i||(t._keysPressed.Shift||t.clearSelection(),t.select(l[0])),t._focus(l[0]),t.scrollTop=0;break;case"End":if(0===l.length)return;i||(t._keysPressed.Shift||t.clearSelection(),t.select(l[l.length-1])),t._focus(l[l.length-1]),t.scrollTop=t.scrollHeight;break;case"PageUp":t._pageUpKeyHandler(l);break;case"PageDown":t._pageDownKeyHandler(l)}t._recycle()}}_horizontalScrollbarHandler(e){const t=this;e&&e.stopPropagation&&e.stopPropagation(),t.isVirtualized?t._recycle():t.$.itemsContainer.scrollLeft=t._getScrollLeft(e.detail.value)}_getScrollLeft(e,t){const i=this;if(!i.rightToLeft)return e;if(Smart.Utilities.Core.Browser.Chrome){if(!t){const e=2*(parseInt(getComputedStyle(i.$.itemsInnerContainer).getPropertyValue("--smart-list-item-horizontal-offset"))||0);t=i._scrollWidth-i.$.itemsContainer.offsetWidth-e}e=t-e}else e*=-1;return e}_unsort(){const e=this;e.isUpdating++;const t=function(e,t){let i=e.dataIndex,l=t.dataIndex;return i<l?-1:i>l?1:0};if(e.isVirtualized)if(e._groups.length>0){e._groups.sort(t);let i=[];for(let l=0;l<e._groups.length;l++){const r=e._groups[l],o=[].concat(...r.items);o.sort(t),i.push(r),i=i.concat(o)}e._items=i}else e._items.sort(t);else{if(e._groups.length>0){e._groups.sort(t);let i=[];for(let l=0;l<e._groups.length;l++){const r=e._groups[l],o=[].concat(...r.querySelectorAll("smart-list-item"));o.sort(t),i=i.concat(o)}e._items=i}else e._items.sort(t);e._applySortOrder()}e.isUpdating--}_applySortOrder(){const e=function(e){for(let t=0;t<e.length;t++){const i=e[t],l=i.parentNode;l&&l.appendChild(i)}};e(this._items),e(this._groups)}_sort(){const e=this;if(!e._canSort)return;e.isUpdating++;const t=function(t,i){let l=t.label,r=i.label;if("asc"===e.sortDirection){if(l<r)return-1;if(l>r)return 1}else{if(l<r)return 1;if(l>r)return-1}return 0};if(e._groups.sort(t),e.isVirtualized)if(e._groups.length>0){let i=[];for(let l=0;l<e._groups.length;l++){const r=e._groups[l],o=[].concat(...r.items);i.push(r),o.sort(t),i=i.concat(o)}e._items=i}else e._items.sort(t);else{if(e._groups.length>0){let i=[];for(let l=0;l<e._groups.length;l++){const r=e._groups[l],o=[].concat(...r.querySelectorAll("smart-list-item"));o.sort(t),i=i.concat(o)}e._items=i}else e._items.sort(t);e._applySortOrder()}e.isUpdating--}getItem(e){const t=this;for(let i=0;i<t._items.length;i++)if(t._items[i].value===e||t._items[i].value===""+e)return t._items[i];return null}_focus(e){const t=this;!e||"none"===t.selectionMode||t.disabled||t.readonly||(t._focusedItem&&(t._focusedItem._focused=!1),t._focusedItem=e,t._focusedItem._focused=!0)}_keyDownHandler(e){const t=this,i=(t.shadowRoot||t.getRootNode()).activeElement||document.activeElement;let l=e.key;if(e.metaKey&&(l="Control"),!t.disabled&&!t.readonly&&(!t.filterable||t.$.filterInput!==i)&&t._focused&&0!==t._items.length&&!t.disabled&&!t.displayLoadingIndicator){if(t.editable){if("F2"===l)return void t._dblclickEventHandler({target:t._focusedItem});if(t.$.editInput===i)return}if("none"!==t.selectionMode){switch(e.stopPropagation(),l){case"Down":case"Right":case"Left":case"Up":l="Arrow"+l}if(t.filterable)switch(l){case"ArrowLeft":case"ArrowRight":return;case"ArrowUp":case"ArrowDown":e.preventDefault()}if(t._applyIncrementalSearch(l),!(["Shift","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Control"," ","Home","End","PageUp","PageDown"].indexOf(l)<0))if(e.preventDefault(),!t._focusedItem&&t._items.length>0)"one"===t.selectionMode||"oneOrMany"===t.selectionMode||"oneOrManyExtended"===t.selectionMode?t.select(t._items[0]):t._focus(t._items[0]);else switch(t.selectionMode){case"one":case"zeroAndOne":if("Shift"===l||"Control"===l||" "===l)return;t._handleKeyStrokes(l);break;case"oneOrMany":case"zeroOrOne":case"zeroOrMany":case"radioButton":case"checkBox":if("Shift"===l||"Control"===l)return;t._handleKeyStrokes(l);break;case"oneOrManyExtended":if(" "===l)return;t._keysPressed[l]="keydown"===e.type,t._handleKeyStrokes(l)}}}}_keyUpHandler(e){const t=this,i=(t.shadowRoot||t.getRootNode()).activeElement||document.activeElement;if(!t.editable||t.$.editInput!==i){if(t.filterable&&t.$.filterInput===i)return t._filterTimer&&clearTimeout(t._filterTimer),void(t._filterTimer=setTimeout((function(){const e=t.context;t.context=t,t._filterItems(void 0,void 0,!0),t.scrollTop=t.$.itemsContainer.scrollTop=0,t.scrollLeft=t.$.itemsContainer.scrollLeft=t._getScrollLeft(0),t.context=e}),300));if(t._focused){if(t._focusedItem&&t._focusedItem.hidden&&t._filteredItems.length>0){let e=t._filteredItems[0];e.grouped&&t._filteredItems.length>1&&(e=t._filteredItems[1]),t._focus(e),t._recycle()}e.stopPropagation(),e.preventDefault(),t.disabled||("Escape"===e.key&&Smart.ListBox.DragDrop.Dragging&&t._cancelDrag(),["Shift","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Control"," ","PageUp","PageDown"].indexOf(e.key)<0||(t._keysPressed[e.key]=!1))}}}_cancelDrag(){if(!Smart.ListBox.DragDrop.Dragging)return;Smart.ListBox.DragDrop.Feedback.parentNode&&Smart.ListBox.DragDrop.Feedback.parentNode.removeChild(Smart.ListBox.DragDrop.Feedback);const e=Smart.ListBox.DragDrop.Item,t=e.ownerListBox;if(t.$.fireEvent("dragCancel",{item:e,data:Smart.ListBox.DragDrop,container:t,previousContainer:t}),Smart.ListBox.DragDrop.Feedback=null,Smart.ListBox.DragDrop.DropDetails){let e=Smart.ListBox.DragDrop.DropDetails.item;e&&(e.$.removeClass("smart-list-item-line-feedback"),e.$.removeClass("smart-list-item-bottom-line-feedback"))}document.body.classList.remove("smart-dragging"),delete Smart.ListBox.DragDrop.DraggedFrom,Smart.ListBox.DragDrop.Dragging=!1,Smart.ListBox.DragDrop.Item=null,Smart.ListBox.DragDrop.DropDetails=null}_mouseWheelNative(e,t){const i=this;void 0===i._scrollWheelContent&&(i._scrollWheelContent=document.createElement("div"),i._scrollWheelContent.style.width="100%",i._scrollWheelContent.style.height="100%",i._scrollWheelContent.style.position="absolute",i._scrollWheelContent.style.left="0px",i._scrollWheelContent.style.top="0px",i._scrollWheelContent.style.background="white",i._scrollWheelContent.style.zIndex=9999,i._scrollWheelContent.style.opacity=0,i._scrollWheelContent.style.overflow="auto",i._scrollWheelContent.style.visibility="hidden");let l=0;const r=()=>{if(t){const t=i._scrollWheelContent.scrollLeft;i._scrollView.hScrollBar.value=t,t===e&&i._scrollWheelContent.remove()}else{const t=i._scrollWheelContent.scrollTop;i._scrollView.vScrollBar.value=t,t===e&&i._scrollWheelContent.remove()}};i._scrollWheelContent.onscroll=()=>{cancelAnimationFrame(l),l=0,l=requestAnimationFrame(r)},i._scrollWheelContentView||(i._scrollWheelContentView=document.createElement("div"),i._scrollWheelContent.appendChild(i._scrollWheelContentView)),i._scrollWheelContentView.style.width=i.offsetWidth+i._scrollView.scrollWidth+"px",i._scrollWheelContentView.style.height=i.offsetHeight+i._scrollView.scrollHeight+"px",i.$.container.appendChild(i._scrollWheelContent),i._scrollWheelContent.scrollTop=i._scrollView.vScrollBar.value,i._scrollWheelContent.scrollLeft=i._scrollView.hScrollBar.value,!0===t?i._scrollWheelContent.scrollTo({top:i._scrollView.vScrollBar.value,left:e,behavior:"smooth"}):i._scrollWheelContent.scrollTo({top:e,left:i._scrollView.hScrollBar.value,behavior:"smooth"})}_mouseWheelHandler(e){const t=this;if(t._scrollView.hScrollBar.$.hasClass("smart-hidden")&&t._scrollView.vScrollBar.$.hasClass("smart-hidden"))return;if(42===e.pointerId)return;if(t._isUpdating())return;let i=!1;if(e.wheelDeltaY?120!==Math.abs(e.wheelDeltaY)&&240!==Math.abs(e.wheelDeltaY)&&360!==Math.abs(e.wheelDeltaY)&&(i=!0):0===e.deltaMode&&(i=!0),t.disabled||t._scrollView.vScrollBar.$.hasClass("smart-hidden")||e.shiftKey||!e.deltaY){if(!t.disabled&&(!t._scrollView.hScrollBar.$.hasClass("smart-hidden")||e.shiftKey)){e.stopPropagation(),e.preventDefault();let l=160;const r=0===e.deltaX?e.wheelDelta:e.deltaX;r<0&&(l=-160),Math.abs(r)>=100&&!i&&!Smart.Utilities.Core.Browser.Firefox?t._mouseWheelNative(t._scrollView.scrollLeft+l,!0):t._scrollView.scrollLeft+=r}}else{const l=t.scrollTop;if(0===l&&e.deltaY<0||l===t.scrollHeight&&e.deltaY>0)return;e.stopPropagation(),e.preventDefault();const r=t.itemHeight?t.itemHeight:30;let o=7*r;if(e.deltaY<=0&&(o=-7*r),Math.abs(e.deltaY)>=100&&!i&&!Smart.Utilities.Core.Browser.Firefox)t._mouseWheelNative(t._scrollView.scrollTop+o);else{t._wheelrafId=0;const i=()=>{t._scrollView.scrollTop+=e.deltaY};cancelAnimationFrame(t._wheelrafId),t._wheelrafId=0,t._wheelrafId=requestAnimationFrame(i)}}}_pageDownKeyHandler(e){const t=this;if(0===e.length)return;let i,l=t._items[t.selectedIndexes[t.selectedIndexes.length-1]];if("checkBox"!==t.selectionMode&&"radioButton"!==t.selectionMode&&"zeroOrMany"!==t.selectionMode&&"oneOrMany"!==t.selectionMode&&"zeroOrOne"!==t.selectionMode||t._focusedItem&&(l=t._focusedItem),!l)return;const r=t._indexOf(l);let o=l.top+t.$.itemsContainer.offsetHeight-l.height;for(let t=r;t<e.length;t++)if(e[t].top>=o){i=e[t];break}i||(i=e[e.length-1]),"checkBox"===t.selectionMode||"radioButton"===t.selectionMode||"zeroOrMany"===t.selectionMode||"oneOrMany"===t.selectionMode||"zeroOrOne"===t.selectionMode?t._focus(i):i.selected||(t._keysPressed.Shift||t.clearSelection(),t.select(i),t._focus(i)),(i.height+i.top>t.$.itemsContainer.scrollTop+t.$.itemsContainer.offsetHeight||i.top<t.$.itemsContainer.scrollTop)&&(t.scrollTop=i.top-t.$.itemsContainer.offsetHeight+i.height)}_pageUpKeyHandler(e){const t=this;if(0===e.length)return;let i=t._items[t.selectedIndexes[t.selectedIndexes.length-1]];if("checkBox"!==t.selectionMode&&"radioButton"!==t.selectionMode&&"zeroOrMany"!==t.selectionMode&&"oneOrMany"!==t.selectionMode&&"zeroOrOne"!==t.selectionMode||t._focusedItem&&(i=t._focusedItem),!i)return;const l=i.top-t.$.itemsContainer.offsetHeight;let r;for(let o=t._indexOf(i);o>0;o--)if(e[o].top<=l){r=e[o];break}r||(r=e[0]),"checkBox"===t.selectionMode||"radioButton"===t.selectionMode||"zeroOrMany"===t.selectionMode||"oneOrMany"===t.selectionMode||"zeroOrOne"===t.selectionMode?t._focus(r):r.selected||(t._keysPressed.Shift||t.clearSelection(),t.select(r),t._focus(r)),t.scrollTop=r.top,0===t._indexOf(r)&&(t.scrollTop=0)}clearItems(){const e=this;e.clearSelection(),e.$.itemsInnerContainer.innerHTML="",e._items=[],delete e._focusedItem,e.$placeholder.removeClass("smart-hidden"),e.refresh()}_resizeHandler(e){this.refresh(e)}refresh(e){const t=this;if(!e&&!t._isUpdatingScrollBars&&t.isInitialized)return t._isUpdatingScrollBars=!0,t._initializeRecyclingItems(),t._refreshLayout(),void(t._isUpdatingScrollBars=!1);e&&e.target===t&&!t._isUpdatingScrollBars&&(t._isUpdatingScrollBars=!0,t._initializeRecyclingItems(),t._refreshLayout(),t._isUpdatingScrollBars=!1)}_indexOf(e){const t=this;if(!e)return-1;let i=t._items.indexOf(e);return-1===i&&(i=t._items.indexOf(t.getItem(e.value))),i}_incrementalSearch(){const e=this,t="radioButton"!==e.selectionMode&&"checkBox"!==e.selectionMode&&"zeroOrMany"!==e.selectionMode&&"oneOrMany"!==e.selectionMode&&"zeroOrOne"!==e.selectionMode;let i,l=0;switch(e.incrementalSearchMode){case"containsIgnoreCase":case"equalsIgnoreCase":case"startsWithIgnoreCase":case"endsWithIgnoreCase":i=e._incrementalSearchQuery.toLowerCase();break;default:i=e._incrementalSearchQuery}const r=function(i){i.grouped||i.readonly||(t?(e.selectedIndexes.length>0&&e.clearSelection(),e._focus(i),e.select(i)):e._focus(i),(i.height+i.top>e.$.itemsContainer.scrollTop+e.$.itemsContainer.offsetHeight||i.top<e.scrollTop)&&(e.scrollTop=i.top),0===e._indexOf(i)&&(e.scrollTop=0),e._indexOf(i)===e._items.length-1&&(e.scrollTop=e.scrollHeight))};0!==e._previousEntry.localeCompare(i)&&(e._incrementalSearchItems=e._queryItems(e._incrementalSearchQuery,e.incrementalSearchMode),delete e._itemPosition),e._previousEntry=i;const o=e._incrementalSearchItems.length;if(0!==o)if(1!==o)for(void 0!==e._itemPosition?e._itemPosition<o-1?l=e._itemPosition:(l=0,t?(e._incrementalSearchItems[e._itemPosition].selected=!1,e.selectedIndexes=[],e.selectedValues=[]):e._incrementalSearchItems[e._itemPosition]._focused=!1):t&&e.clearSelection();l<o;l++)if(e._incrementalSearchItems[l].selected&&t)e._incrementalSearchItems[l].selected=!1,e.selectedIndexes=[],e.selectedValues=[];else{if(t||!e._incrementalSearchItems[l]._focused)return r(e._incrementalSearchItems[l]),void(e._itemPosition=l);e._incrementalSearchItems[l]._focused=!1}else r(e._incrementalSearchItems[0])}_selectStartHandler(e){const t=this,i=(t.shadowRoot||t.getRootNode()).activeElement;t.$.filterInput!==i&&t.$.editInput!==i&&e.preventDefault()}_handleArrowKeys(e){const t=this,i="radioButton"!==t.selectionMode&&"checkBox"!==t.selectionMode&&"zeroOrMany"!==t.selectionMode&&"oneOrMany"!==t.selectionMode&&"zeroOrOne"!==t.selectionMode;if(t.disabled||t.readonly)return;let l;if(t._focusedItem&&!t._keysPressed.Shift)l=t._indexOf(t._focusedItem),t._focusedItem._focused=!1;else{if(0===t.selectedIndexes.length)return;l=t.selectedIndexes[t.selectedIndexes.length-1]}const r=e?t._getPreviousItem(l):t._getNextItem(l);t._focus(r),i&&(t._keysPressed.Shift?t.select(r):t._items[l]!==r&&(t.clearSelection(),t.select(r))),t.ensureVisible(r)}focusFilter(){const e=this;e.filterable&&e.$.filterInput.focus()}_refreshFilter(){const e=this;if(e.filterable)return e.$.filterInput.onpointerdown=function(e){},e.$.filterInput.onpointerup=function(e){e.stopPropagation()},e.$.filterInput.disabled=!(!e.disabled&&!e.displayLoadingIndicator),e.$filterInputContainer.removeClass("smart-hidden"),void e.$itemsContainer.addClass("filter");e.$.filterInput.disabled=!0,e.$filterInputContainer.addClass("smart-hidden"),e.$itemsContainer.removeClass("filter")}_setFocusable(){const e=this;e.disabled||e.unfocusable?e.removeAttribute("tabindex"):e.tabIndex=e.tabIndex>0?e.tabIndex:0}_setLoadingIndicatorVisibility(){const e=this;e.displayLoadingIndicator?e.$loadingIndicatorContainer.hasClass("smart-visibility-hidden")?e.$loadingIndicatorContainer.removeClass("smart-visibility-hidden"):e.$loadingIndicatorContainer.removeClass("smart-hidden"):e._areCSSVarsSupported?e.$loadingIndicatorContainer.addClass("smart-hidden"):e.$loadingIndicatorContainer.addClass("smart-visibility-hidden")}_refreshLayout(){const e=this;let t=e._filteredItems||e._items;if(e.__scrollHeight=null,e.__scrollWidth=null,e._height=null,e._scrollView||(e._scrollView=new Smart.Utilities.Scroll(e,e.$.horizontalScrollBar,e.$.verticalScrollBar)),e.$itemsContainer.removeClass("hscroll"),e.$itemsContainer.removeClass("vscroll"),!t||null===t||0===t.length)return e.scrollWidth=0,e.scrollHeight=0,e.$filterInputContainer.removeClass("vscroll"),e.$placeholder.removeClass("smart-hidden"),e.isVirtualized&&e._recycle(),void(e.$.itemsInnerContainer.style.width="");e.$placeholder.addClass("smart-hidden");const i=2*(parseInt(getComputedStyle(e.$.itemsContainer).getPropertyValue("--smart-list-item-horizontal-offset"))||0);let l=e._scrollWidth-e.$.itemsContainer.offsetWidth-i,r=e._scrollHeight;if(e._refreshHorizontalScrollBarVisibility(l),e._refreshVerticalScrollBarVisibility(r),e.$.itemsInnerContainer.style.width="","hidden"===e.horizontalScrollBarVisibility?e.$.itemsInnerContainer.style.width=e.$.itemsContainer.offsetWidth-i:e.$.itemsInnerContainer.style.width=Math.max(e.$.itemsContainer.offsetWidth-i,-i+e.__scrollWidth)+"px",e.computedVerticalScrollBarVisibility)return l=e._scrollWidth-e.$.itemsContainer.offsetWidth-i,e._refreshHorizontalScrollBarVisibility(l),"hidden"!==e.horizontalScrollBarVisibility&&(e.$.itemsInnerContainer.style.width="",e.$.itemsInnerContainer.style.width=Math.max(e.$.itemsContainer.offsetWidth-i,-i+e.__scrollWidth)+"px"),e.computedHorizontalScrollBarVisibility&&(("visible"!==e.horizontalScrollBarVisibility||0!==e.scrollWidth||"visible"===e.horizontalScrollBarVisibility)&&(e.__scrollHeight+=e._scrollView.hScrollBar.offsetHeight),e.scrollHeight=e.__scrollHeight,e._scrollView.hScrollBar.$.hasClass("bottom-corner")&&e._scrollView.hScrollBar.refresh()),void(e.isVirtualized&&e._recycle());l=e._scrollWidth-e.$.itemsContainer.offsetWidth-i,e._refreshHorizontalScrollBarVisibility(l),e.computedHorizontalScrollBarVisibility&&(e.scrollHeight=e._scrollHeight,e._refreshVerticalScrollBarVisibility(e.scrollHeight),e.computedVerticalScrollBarVisibility&&(l=e._scrollWidth-e.$.itemsContainer.offsetWidth-e._scrollView.vScrollBar.offsetWidth,e._refreshHorizontalScrollBarVisibility(l)),e._scrollView.vScrollBar.$.hasClass("bottom-corner")&&e._scrollView.vScrollBar.refresh(),e._scrollView.hScrollBar.$.hasClass("bottom-corner")&&e._scrollView.hScrollBar.refresh()),e.isVirtualized&&e._recycle();const o=/Trident|Edge/.test(navigator.userAgent);!e.isRefreshing&&o&&setTimeout((function(){e.isRefreshing=!0,e._refreshLayout(),e.isRefreshing=!1}),50)}_styleChangedHandler(){this._refreshLayout()}_swipeLeftHandler(){}_swipeRightHandler(){}_refreshHorizontalScrollBarVisibility(e){const t=this;t.scrollWidth=e,t.$.horizontalScrollBar.refresh(),t.computedHorizontalScrollBarVisibility?(t.scrollLeft=t._getScrollLeft(t.$.itemsContainer.scrollLeft,e),t.$itemsContainer.addClass("hscroll")):t.$itemsContainer.removeClass("hscroll")}_refreshVerticalScrollBarVisibility(e){const t=this;t.scrollHeight=e,t.$.verticalScrollBar.refresh(),t.computedVerticalScrollBarVisibility?(t.$itemsContainer.addClass("vscroll"),t.$filterInputContainer.addClass("vscroll")):(t.$itemsContainer.removeClass("vscroll"),t.$filterInputContainer.removeClass("vscroll"))}_validateTemplate(e,t){if(null===t||!t)return;const i=this;return"content"in document.createElement("template")?null!==(t=document.getElementById(t))&&"content"in t?t:(i.error(i.localize("invalidTemplate",{elementType:i.nodeName.toLowerCase(),property:e})),void(i[e]=null)):(i.error(i.localize("htmlTemplateNotSuported",{elementType:i.nodeName.toLowerCase()})),void(i[e]=null))}_getItemIndexByPosition(e){const t=this;return(i=>{let l=0,r=i.length-1;if(e<=0)return 0;if(i[i.length-1].top<=e)return i.length-1;for(;;){const o=Math.floor((l+r)/2),s=i[o];if(t._isItemInPosition(s,e))return o;s.top<e?l=o+1:s.top>e&&(r=o-1)}})(t.$.filterInput.value.length>0?t._filteredItems:t._items)}_isItemInPosition(e,t){const i=e.top,l=e.top+e.height;return i<=t&&l>t}get isVirtualized(){const e=this;return e.virtualized&&e.dataSource&&e.dataSource.length>0}_recycle(){const e=this;if(!e._recyclingItems)return;let t=e._height;e._height||(t=e._height=e.$.itemsContainer.offsetHeight);let i=0;const l=e.scrollTop,r=e._getItemIndexByPosition(l),o=e.filterable&&e.$.filterInput.value.length>0?e._filteredItems:e._items,s=o[r];let n=s?s.top:0;if(e.$.itemsInnerContainer.style.left=-e.scrollLeft+"px",e.$.itemsInnerContainer.style.top=-l+n+"px",e.isUpdating++,r>=0){const s=o.length;for(let a=r;a<s;a++){const r=o[a];if(0!==r.height){if(!(n+r.height>=l&&n<=l+t))break;{const t=e._recyclingItems[i++];if(!t)break;t.setAttribute("aria-setsize",s),t.setAttribute("aria-posinset",a),t.context=document,t.dataItem=r,t.label=r.label,t.value=r.value,t.selected=r.selected,t._focused=r._focused,t.hidden=r.hidden,t.grouped=r.grouped,t.readonly=r.readonly,t.style.height=r.height+"px",e._alternateItem(t),r.title?t.title=r.title:t.title="",r.grouped?t.displayMode="plain":t.displayMode=r.displayMode,e.scrollWidth>0&&(t.style.width=e.$.itemsInnerContainer.offsetWidth+e.scrollWidth+"px"),e.itemTemplate&&e._handleItemTemplate(e.itemTemplate)&&e._applyTemplate(t,!1)}n+=r.height}}}if(i<e._recyclingItems.length)for(let t=i;t<e._recyclingItems.length;t++){const t=e._recyclingItems[i++],l=t.context;t.context=document,t.hidden=!0,t.context=l}e.isUpdating--}_verticalScrollbarHandler(e){const t=this,i=e.detail.value;e&&e.stopPropagation&&e.stopPropagation(),t.isVirtualized?t._recycle():t.$.itemsContainer.scrollTop=i,t._updateTopVisibleIndex(),e.context.max!==e.context.value?e.context.min===e.context.value&&t.$.fireEvent("scrollTopReached"):t.$.fireEvent("scrollBottomReached")}_applyAriaSelected(){const e=this,t=e.isVirtualized?e._recyclingItems:e._items,i=e.selectionMode;for(let e=0;e<t.length;e++){const l=t[e];l.selected?l.setAttribute("aria-selected",!0):l.readonly||l.disabled||-1===["oneOrManyExtended","zeroOrMany","oneOrMany","checkBox"].indexOf(i)?l.removeAttribute("aria-selected"):l.setAttribute("aria-selected",!1)}}});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
|
-
/* Smart UI
|
|
2
|
+
/* Smart UI v25.0.0 (2025-11-26)
|
|
3
3
|
Copyright (c) 2011-2024 jQWidgets.
|
|
4
4
|
License: https://htmlelements.com/license/ */ //
|
|
5
5
|
|
|
6
|
-
Smart("smart-multiline-text-box",class extends Smart.TextBox{static get properties(){return{autoCapitalize:{value:"none",allowedValues:["none","words","characters"],type:"string"},autoComplete:{value:"off",allowedValues:["on","off"],type:"string"},autoExpand:{value:!1,type:"boolean"},cols:{value:20,type:"number?"},enterKeyBehavior:{value:"newLine",allowedValues:["submit","clearOnSubmit","newLine"],type:"string"},horizontalScrollBarVisibility:{type:"string",value:"auto",allowedValues:["auto","disabled","hidden","visible"]},minLength:{value:0,type:"number"},resizable:{value:!1,type:"boolean"},rows:{value:5,type:"number?"},selectionDirection:{value:"none",allowedValues:["forward","backward","none"],type:"string"},selectionEnd:{value:0,reflectToAttribute:!1,type:"number"},selectionStart:{value:0,reflectToAttribute:!1,type:"number"},spellCheck:{value:!1,type:"boolean"},type:{value:"textarea",type:"string",defaultReflectToAttribute:!0,readonly:!0},verticalScrollBarVisibility:{type:"string",value:"auto",allowedValues:["auto","disabled","hidden","visible"]},wrap:{value:"soft",allowedValues:["hard","soft","off"],type:"string"}}}static get styleUrls(){return["smart.textbox.css","smart.multilinetextbox.css"]}static get listeners(){return{"document.mousemove":"_documentSelectionOutsideHandler","container.resize":"_handleScrollbarsDisplay","document.move":"_resizeMoveHandler","document.up":"_upHandler",focus:"_focusHandler","horizontalScrollBar.change":"_horizontalScrollbarHandler",keydown:"_keyDownHandler",mouseenter:"_mouseEventsHandler",mouseleave:"_mouseEventsHandler",resize:"_handleScrollbarsDisplay","resizeElement.down":"_resizeDownHandler",styleChanged:"_handleScrollbarsDisplay","input.change":"_textBoxChangeHandler","input.focus":"_focusHandler","input.blur":"_blurHandler","input.keydown":"_textBoxKeyDownHandler","input.keyup":"_keyUpHandler","input.paste":"_textBoxChangeHandler","input.select":"_textBoxSelectHandler","input.touchmove":"_inputTouchmoveHandler","input.touchstart":"_inputTouchstartHandler",wheel:"_mouseWheelHandler","verticalScrollBar.change":"_verticalScrollbarHandler"}}attached(){const e=this;super.attached(),e._scrollView||(e._scrollView=new Smart.Utilities.Scroll(e.$.input,e.$.horizontalScrollBar,e.$.verticalScrollBar))}detached(){const e=this;super.detached(),e._scrollView&&(e._scrollView.unlisten(),delete e._scrollView)}static get requires(){return{"Smart.ScrollBar":"smart.scrollbar.js"}}template(){return'<div id="container" role="presentation">\n <span id="label" class="smart-label">[[label]]</span>\n <div id="innerContainer" class="smart-inner-container" role="presentation">\n <textarea class="smart-input" id="input"\n autocapitalize="[[autoCapitalize]]"\n autocomplete="off"\n cols="[[cols]]"\n disabled="[[disabled]]"\n maxlength="[[maxLength]]"\n minlength="[[minLength]]"\n name="[[name]]"\n placeholder="[[placeholder]]"\n readonly="[[readonly]]"\n required="[[required]]"\n rows="[[rows]]"\n spellcheck="[[spellCheck]]"\n wrap="[[wrap]]"\n aria-label="[[placeholder]]"\n autocomplete="[[inputPurpose]]"></textarea>\n <smart-scroll-bar id="verticalScrollBar" theme="[[theme]]" right-to-left="[[rightToLeft]]" animation="[[animation]]" disabled="[[disabled]]" orientation="vertical"></smart-scroll-bar>\n <smart-scroll-bar id="horizontalScrollBar" theme="[[theme]]" right-to-left="[[rightToLeft]]" animation="[[animation]]" disabled="[[disabled]]"></smart-scroll-bar>\n <div id="resizeElement" class="smart-resize-element" aria-label="Resize"></div>\n\n <textarea id="textBoxHidden"\n class="smart-text-box-hidden"\n autocapitalize="[[autoCapitalize]]"\n autocomplete="off"\n cols="[[cols]]"\n disabled="[[disabled]]"\n inner-h-t-m-l="[[value]]"\n maxlength="[[maxLength]]"\n minlength="[[minLength]]"\n name="[[name]]"\n placeholder="[[placeholder]]"\n readonly="[[readonly]]"\n required="[[required]]"\n rows="[[rows]]"\n spellcheck="[[spellCheck]]"\n wrap="[[wrap]]"></textarea>\n </div>\n <span id="hint" class="smart-hidden smart-hint">[[hint]]</span>\n </div>'}propertyChangedHandler(e,t,l){const a=this;switch(e){case"autoExpand":a._autoExpandUpdate();break;case"displayMode":switch(l){case"escaped":a.$.input.value=a._toEscapedDisplayMode(a.value);break;default:a.$.input.value=a.value=a._toDefaultDisplayMode(a.$.input.value)}a._autoExpandUpdate(),a._handleScrollbarsDisplay();break;case"value":switch(a._preventProgramaticValueChange?(a._userValue="escaped"===a.displayMode?a._toDefaultDisplayMode(a.$.input.value):a.$.input.value,a._programmaticValue=l):a._userValue=a._programmaticValue=l,a.displayMode){case"escaped":a.$.input.value=a._toEscapedDisplayMode(a._userValue);break;default:a.$.input.value=a._userValue}a._oldValue=t,a._autoExpandUpdate(),a._handleScrollbarsDisplay();break;case"horizontalScrollBarVisibility":case"verticalScrollBarVisibility":case"singleLine":case"wrap":case"resizable":case"placeholder":a._autoExpandUpdate(),a._handleScrollbarsDisplay();break;case"selectionEnd":case"selectionStart":a._handleSelectedText();break;case"rows":case"cols":a._updateSizeRowsCols();break;case"disabled":a._setFocusable(),a._ariaPropertyChangedHandler("disabled",l);break;case"animation":break;case"readonly":a._ariaPropertyChangedHandler("readonly",l);break;default:super.propertyChangedHandler(e,t,l)}}selection(e){const t=this;let l=t.$.input.selectionStart,a=t.$.input.selectionEnd,i=t.value;return"escaped"===t.displayMode?(i=t.$.input.value.substring(l,a),"escaped"===e?i:t._toDefaultDisplayMode(i)):"escaped"===e?(i=i.substring(l,a),t._toEscapedDisplayMode(i)):(i=i.substring(l,a),i)}select(e,t){const l=this,a=Array.from(arguments).slice(0,2);let i,n;for(let e in a)a[e]=parseInt(a[e])||0;return 2===a.length?(i=Math.min([e,t]),n=Math.max([e,t])):i=a[0],2===a.length?(i=parseInt(i),i=i>0?i<l.$.input.length?l.$.input.length:i:0,n<i?n=i:n>l.$.input.length&&(i=0),l.$.input.focus(),void l.$.input.setSelectionRange(i,n)):1===a.length?(l.$.input.focus(),void l.$.input.setSelectionRange(i,i+1)):void l.$.input.select()}_autoExpandUpdate(){const e=this,t=e.$.input,l=e.$.textBoxHidden,a=e.$.verticalScrollBar;if(!e.autoExpand)return void(t.style.height=a.style.height=l.style.height=null);const i=parseFloat(window.getComputedStyle(e).getPropertyValue("max-height"));l.style.height=0,l.value=t.value;let n=0;e.resizeTrigger&&(n=e.resizeTrigger.clientHeight,n===e.clientHeight&&(n=0)),t.style.height=a.style.height=(isNaN(i)?l.scrollHeight:Math.min((i||0)-n,l.scrollHeight))+"px"}_blurHandler(){const e=this;e._outsideAutoScroll&&clearInterval(e._outsideAutoScroll),e.removeAttribute("focus"),e._preventProgramaticValueChange=!1,e._oldValue=e.value,e.value=e._userValue||e.value,e.$.fireEvent("blur")}_createElement(){const e=this;e.$.input.id||(e.$.input.id=e.id+"Input"),e.autoFocus&&(navigator.userAgent.match(/Edge/)?setTimeout((function(){e.$.input.focus(),e.setAttribute("focus","")}),10):(e.$.input.focus(),e.setAttribute("focus","")));const t=e.$.input.innerHTML;e.value?e.$.input.innerHTML="escaped"===e.displayMode?e._toEscapedDisplayMode(e.value):e.value:t.length>0&&"escaped"===e.displayMode?(e.value=t,e.$.input.innerHTML=e._toEscapedDisplayMode(t)):t.length>0&&(e.value=t),e._setFocusable(),e._syncTextBoxContentOnInitialization(),e._scrollView=new Smart.Utilities.Scroll(e.$.input,e.$.horizontalScrollBar,e.$.verticalScrollBar),e._autoExpandUpdate(),e._handleScrollbarsDisplay(),e._initializationValue=e._oldValue=e.value,e.value.length>0?e.$.addClass("has-value"):e.$.removeClass("has-value"),e._handleHintContainer(),e.setAttribute("role","textbox"),e.setAttribute("aria-multiline",!0),e.setAttribute("aria-describedby",e.$.hint.id),e.setAttribute("aria-labelledby",e.$.label.id),e.$.verticalScrollBar.setAttribute("aria-controls",e.$.input.id),e.$.horizontalScrollBar.setAttribute("aria-controls",e.$.input.id)}_handleScrollbarsDisplay(e){const t=this,l=t.$.input;requestAnimationFrame((()=>{switch(t._autoExpandUpdate(),t.horizontalScrollBarVisibility){case"disabled":t.$container.addClass("hscroll"),t.$.horizontalScrollBar.disabled=!0;break;case"hidden":t.$container.removeClass("hscroll");break;case"visible":t.$container.addClass("hscroll"),t._scrollView.scrollWidth=l.scrollWidth-l.clientWidth,t._scrollView.scrollTo(t.$.input.scrollLeft,!0),t.$.horizontalScrollBar.disabled=!1;break;default:l.scrollWidth>l.clientWidth?(t.$container.addClass("hscroll"),t._scrollView.scrollWidth=l.scrollWidth-l.clientWidth,e&&"resize"===e.type?t.$.input.scrollLeft=t._scrollView.scrollLeft:t._scrollView.scrollTo(t.$.input.scrollLeft,!0)):t.$container.removeClass("hscroll"),t.$.horizontalScrollBar.disabled=!1}switch(t.verticalScrollBarVisibility){case"disabled":t.$container.addClass("vscroll"),t.$.verticalScrollBar.disabled=!0;break;case"hidden":t.$container.removeClass("vscroll");break;case"visible":t.$container.addClass("vscroll"),t._scrollView.scrollHeight=l.scrollHeight-l.clientHeight,t._scrollView.scrollTo(t.$.input.scrollTop),t.$.verticalScrollBar.disabled=!1;break;default:l.scrollHeight>l.clientHeight?(t.$container.addClass("vscroll"),t._scrollView.scrollHeight=l.scrollHeight-l.clientHeight,e&&"resize"===e.type?t.$.input.scrollTop=t._scrollView.scrollTop:t._scrollView.scrollTo(t.$.input.scrollTop)):t.$container.removeClass("vscroll"),t.$.verticalScrollBar.disabled=!1}}))}_focusHandler(e){const t=this;if(!t.disabled){if(e.target===t)return t.$.input.focus(),void(t._edgeSelect=!1);if(t.setAttribute("focus",""),t.selectAllOnFocus)if(navigator.userAgent.match(/Edge/)){const e=t.$.input.scrollTop;if(t._edgeSelect)return void(t._edgeSelect=!1);setTimeout((function(){t._edgeSelect=!0,t.$.input.select(),t.$.input.scrollTop=e}),5)}else t.$.input.select();t.$.fireEvent("focus")}}_getScrollLeft(e,t){const l=this;return l.rightToLeft?(Smart.Utilities.Core.Browser.Chrome?(t||(t=l.$.input.scrollWidth-l.$.input.offsetWidth),e=t-e):e*=-1,e):e}_horizontalScrollbarHandler(e){const t=this;t.disabled||"hidden"===t.horizontalScrollBarVisibility||"disabled"===t.horizontalScrollBarVisibility||(e.stopPropagation(),t.$.input.scrollLeft=t._getScrollLeft(e.detail.value))}_keyDownHandler(e){const t=this,l=e.key,a=e.shiftKey,i=e.ctrlKey,n=t.$.input.value;function r(l){let a=t.$.input.selectionStart,i=t.$.input.selectionEnd,n=t.$.input.value;e.preventDefault(),t.$.input.value=n.substring(0,a)+l+n.substring(i,n.length),t.value=t._toDefaultDisplayMode(t.$.input.value),t.$.input.selectionStart=a+2,t.$.input.selectionEnd=a+2}if(t.allowVerticalScrollbar&&t.$.input.selectionEnd>t.$.input.value.length-5&&t._scrollView.scrollTo(t._scrollView.scrollTop+(e.deltaY<0?-t.offsetHeight:t.offsetHeight)),l.indexOf("Arrow")>-1)e.stopPropagation();else switch(l){case"Enter":if("newLine"===t.enterKeyBehavior&&!i&&!a||"newLine"!==t.enterKeyBehavior&&(i||a)){"escaped"===t.displayMode&&r("\\n");break}e.preventDefault(),t._userValue="escaped"===t.displayMode?t._toDefaultDisplayMode(t.$.input.value):t.$.input.value,t.value=t._userValue,("submit"===t.enterKeyBehavior||"clearOnSubmit"===t.enterKeyBehavior||""!==n&&t._userValue!==t._oldValue)&&t.$.fireEvent("change",{oldValue:t._oldValue,value:n,type:"submit"}),"clearOnSubmit"===t.enterKeyBehavior&&(t.$.input.value=""),t._oldValue=t.value=t._toDefaultDisplayMode(t.$.input.value),t._submitted=!0,"escaped"===t.displayMode&&t.enterKeyBehavior.toLowerCase().indexOf("submit")<0&&!i&&!a&&r("\\n"),("submit"===t.enterKeyBehavior||"newLine"===t.enterKeyBehavior&&i)&&t.$.input.blur();break;case"Escape":if("none"===t.escKeyMode)return;switch(t.escKeyMode){case"none":break;case"clearValue":t.value=t.$.input.value="";break;case"previousValue":t.$.input.value="escaped"===t.displayMode?t._toEscapedDisplayMode(t._oldValue):t._oldValue}break;case" ":"escaped"===t.displayMode&&r("\\s");break;case"Backspace":if("escaped"===t.displayMode&&t.$.input.selectionStart===t.$.input.selectionEnd){let e=t.$.input.selectionStart;"\\"!==n[e-2]||"s"!==n[e-1]&&"n"!==n[e-1]||(t.$.input.value=t.$.input.value.substring(0,e-2)+t.$.input.value.substring(e-2,t.$.input.value.length),t.$.input.selectionStart=e-2)}t._scrollView&&t._handleScrollbarsDisplay()}}_keyUpHandler(e){const t=this;switch(e.key){case"ArrowLeft":case"ArrowUp":case"ArrowDown":t._handlePointerInEscapedSymbol();break;case"ArrowRight":t._handlePointerInEscapedSymbol("next")}t._userValue="escaped"===t.displayMode?t._toDefaultDisplayMode(t.$.input.value):t.$.input.value,t._submitKeyUpHandler()}_textBoxKeyDownHandler(e){const t=this,l=e.key;t._scrollView&&t._handleScrollbarsDisplay(),t.value&&t.value.length>0?t.$.addClass("has-value"):t.$.removeClass("has-value"),-1===["Enter","Escape"].indexOf(l)&&(t._preventProgramaticValueChange=!0),["ArrowLeft","ArrowUp","ArrowDown","ArrowRight"].indexOf(l)>-1&&t._scrollView.scrollTo(t.$.input.scrollTop),["PageUp","PageDown"].indexOf(l)>-1&&Smart.Utilities.Core.Browser.Chrome&&("PageUp"===e.key&&(t.$.input.setSelectionRange(0,0),t.$.input.scrollTop=0),"PageDown"===e.key&&(t.$.input.setSelectionRange(t.$.input.value.length,t.$.input.value.length),t.$.input.scrollTop=t._scrollView.verticalScrollBar.max),e.preventDefault())}_mouseWheelHandler(e){const t=this;t.disabled||t.$.verticalScrollBar.disabled||(t._scrollView.scrollTo(t._scrollView.scrollTop+(e.deltaY<0?-t.offsetHeight:t.offsetHeight)),t.$.input.scrollTop+=e.deltaY<0?-t.offsetHeight:t.offsetHeight,t.$.input.scrollTop>0&&e.preventDefault())}_syncTextBoxContentOnInitialization(){const e=this;let t;t=""===e.value?e.innerHTML:e.value,"escaped"!==e.displayMode?e.$.input.value=e.value=e._initializationValue=t:t.match(/\r\n|\n\r|\n|\r|\s|\t|\f|\r/g)?(e.value=e._initializationValue=t,e.$.input.value=e._toEscapedDisplayMode(t)):(e.value=e._initializationValue=e._toDefaultDisplayMode(t),e.$.input.value=t)}_textBoxChangeHandler(e){const t=this,l=e.clipboardData||e.originalEvent&&e.originalEvent.clipboardData||window.clipboardData,a=t.value;if("escaped"===t.displayMode){const a=t.$.input.selectionStart,i=t.$.input.selectionEnd;if(l){let n=l.getData("text"),r=t.$.input.value;e.preventDefault(),n=t._toEscapedDisplayMode(n),t.$.input.value=r.substring(0,a)+n+r.substring(i,r.length)}t.value=t._toDefaultDisplayMode(t.$.input.value)}else t.value=t.$.input.value;t._handleScrollbarsDisplay(),t.value.length>0?t.$.addClass("has-value"):t.$.removeClass("has-value"),l||t.$.fireEvent("change",{value:t.value,oldValue:a,type:"blur"}),t._handleHintContainer()}_inputTouchmoveHandler(e){const t=this;if((t._resizeStarted||t._touchmoveInside)&&e.cancelable)return e.preventDefault(),void e.stopPropagation();const l=t.$.container.classList.contains("vscroll"),a=t._touchCoords;if(!t.$.container.classList.contains("hscroll")&&!l||!a)return;const i=t._scrollView,n=e.touches[0];let r,o,s,c;t._touchCoords=[n.pageX,n.pageY],l?(r=i.scrollTop,o=i.scrollHeight,s=n.pageY,c=a[1]):(r=i.scrollLeft,o=i.scrollWidth,s=n.pageX,c=a[0]);const u=parseFloat(s.toFixed(5)),d=parseFloat(c.toFixed(5));0===r&&u>=d||r===o&&u<=d||(s!==c&&(t._touchmoveInside=!0),e.cancelable&&(e.preventDefault(),e.stopPropagation()))}_inputTouchstartHandler(e){const t=e.touches[0];this._touchCoords=[t.pageX,t.pageY]}_resizeDownHandler(){const e=this;!e.disabled&&e.resizable&&(e._resizeStarted=!0,e.$container.addClass("smart-resize"),e.readonly||e.$.input.setAttribute("readonly",""))}_resizeMoveHandler(e){const t=this;if(t.disabled||!t.resizable||!t._resizeStarted)return;const l=t.getBoundingClientRect(),a=50,i=50,n=t.rightToLeft?l.width+l.left-e.clientX:e.clientX-l.left,r=e.clientY-l.top;n>a&&(t.style.width=n+"px"),r>i&&(t.style.height=r+"px")}_updateSizeRowsCols(){const e=this;e.$.container.removeAttribute("style"),setTimeout((function(){if(!("disabled"!==e.horizontalScrollBarVisibility&&"hidden"!==e.horizontalScrollBarVisibility||"disabled"!==e.verticalScrollBarVisibility&&"hidden"!==e.verticalScrollBarVisibility))return;const t=e.getBoundingClientRect();e.$.container.style.width=t.width+"px",e.$.container.style.height=t.height+"px"}),0)}_upHandler(e){const t=this;delete t._touchCoords,delete t._touchmoveInside,t._selectionStarted=!1,t.disabled||(e.originalEvent.target!==t.$.input?(t.$container.removeClass("smart-resize"),t.readonly||t.$.input.removeAttribute("readonly"),t._resizeStarted&&t.$.input.focus(),t._resizeStarted=!1):t._handlePointerInEscapedSymbol())}_verticalScrollbarHandler(e){const t=this;t.disabled||"disabled"===t.verticalScrollBarVisibility||"hidden"===t.verticalScrollBarVisibility||(e.stopPropagation(),t.$.input.scrollTop=e.detail.value)}_documentDownHandler(e){const t=this;t._selectionStarted=!1,e.originalEvent&&t.$.input.contains(e.originalEvent.target)&&(t._selectionStarted=!0,t._selectionStartTime=new Date,t._pointerDown={pageX:e.pageX,pageY:e.pageY},t._edgeSelect=!1)}_documentSelectionOutsideHandler(e){const t=this;if(clearInterval(t._outsideAutoScroll),!t._selectionStarted)return;const l=t.$.input.getBoundingClientRect(),a=l.y+10,i=l.y+l.height-10;function n(l){const a=t.getBoundingClientRect(),i=document.documentElement,n=l?"Left":"Top";(l?a.left+i.scrollLeft-e.pageX:a.top+i.scrollTop-e.pageY)>0?(t.$.input["scroll"+n]-=10,t._scrollView["scroll"+n]-=10):(t.$.input["scroll"+n]+=10,t._scrollView["scroll"+n]+=10)}e.pageY>a&&e.pageY<i||!(new Date-t._selectionStartTime<300)&&(Math.abs(t._pointerDown.pageX-e.pageX)>=3||Math.abs(t._pointerDown.pageY-e.pageY)>=3)&&(t._outsideAutoScroll=setInterval((function(){n(),n(!0)}),10))}_selectStartHandler(){}_styleChangedHandler(){}});
|
|
6
|
+
Smart("smart-multiline-text-box",class extends Smart.TextBox{static get properties(){return{autoCapitalize:{value:"none",allowedValues:["none","words","characters"],type:"string"},autoComplete:{value:"off",allowedValues:["on","off"],type:"string"},autoExpand:{value:!1,type:"boolean"},cols:{value:20,type:"number?"},enterKeyBehavior:{value:"newLine",allowedValues:["submit","clearOnSubmit","newLine"],type:"string"},horizontalScrollBarVisibility:{type:"string",value:"auto",allowedValues:["auto","disabled","hidden","visible"]},minLength:{value:0,type:"number"},resizable:{value:!1,type:"boolean"},rows:{value:5,type:"number?"},selectionDirection:{value:"none",allowedValues:["forward","backward","none"],type:"string"},selectionEnd:{value:0,reflectToAttribute:!1,type:"number"},selectionStart:{value:0,reflectToAttribute:!1,type:"number"},spellCheck:{value:!1,type:"boolean"},type:{value:"textarea",type:"string",defaultReflectToAttribute:!0,readonly:!0},verticalScrollBarVisibility:{type:"string",value:"auto",allowedValues:["auto","disabled","hidden","visible"]},wrap:{value:"soft",allowedValues:["hard","soft","off"],type:"string"}}}static get styleUrls(){return["smart.textbox.css","smart.multilinetextbox.css"]}static get listeners(){return{"document.mousemove":"_documentSelectionOutsideHandler","container.resize":"_handleScrollbarsDisplay","document.move":"_resizeMoveHandler","document.up":"_upHandler",focus:"_focusHandler","horizontalScrollBar.change":"_horizontalScrollbarHandler",keydown:"_keyDownHandler",mouseenter:"_mouseEventsHandler",mouseleave:"_mouseEventsHandler",resize:"_handleScrollbarsDisplay","resizeElement.down":"_resizeDownHandler",styleChanged:"_handleScrollbarsDisplay","input.change":"_textBoxChangeHandler","input.focus":"_focusHandler","input.blur":"_blurHandler","input.keydown":"_textBoxKeyDownHandler","input.keyup":"_keyUpHandler","input.paste":"_textBoxChangeHandler","input.select":"_textBoxSelectHandler","input.touchmove":"_inputTouchmoveHandler","input.touchstart":"_inputTouchstartHandler",wheel:"_mouseWheelHandler","verticalScrollBar.change":"_verticalScrollbarHandler"}}attached(){const e=this;super.attached(),e._scrollView||(e._scrollView=new Smart.Utilities.Scroll(e.$.input,e.$.horizontalScrollBar,e.$.verticalScrollBar))}detached(){const e=this;super.detached(),e._scrollView&&(e._scrollView.unlisten(),delete e._scrollView)}static get requires(){return{"Smart.ScrollBar":"smart.scrollbar.js"}}template(){return'<div id="container" role="presentation">\n <span id="label" class="smart-label">[[label]]</span>\n <div id="innerContainer" class="smart-inner-container" role="presentation">\n <textarea class="smart-input" id="input"\n autocapitalize="[[autoCapitalize]]"\n autocomplete="off"\n cols="[[cols]]"\n disabled="[[disabled]]"\n maxlength="[[maxLength]]"\n minlength="[[minLength]]"\n name="[[name]]"\n placeholder="[[placeholder]]"\n readonly="[[readonly]]"\n required="[[required]]"\n rows="[[rows]]"\n spellcheck="[[spellCheck]]"\n wrap="[[wrap]]"\n aria-label="[[placeholder]]"\n autocomplete="[[inputPurpose]]"></textarea>\n <smart-scroll-bar id="verticalScrollBar" theme="[[theme]]" right-to-left="[[rightToLeft]]" animation="[[animation]]" disabled="[[disabled]]" orientation="vertical"></smart-scroll-bar>\n <smart-scroll-bar id="horizontalScrollBar" theme="[[theme]]" right-to-left="[[rightToLeft]]" animation="[[animation]]" disabled="[[disabled]]"></smart-scroll-bar>\n <div id="resizeElement" class="smart-resize-element" aria-label="Resize"></div>\n\n <textarea id="textBoxHidden"\n class="smart-text-box-hidden"\n autocapitalize="[[autoCapitalize]]"\n autocomplete="off"\n cols="[[cols]]"\n disabled="[[disabled]]"\n inner-h-t-m-l="[[value]]"\n maxlength="[[maxLength]]"\n minlength="[[minLength]]"\n name="[[name]]"\n placeholder="[[placeholder]]"\n readonly="[[readonly]]"\n required="[[required]]"\n rows="[[rows]]"\n spellcheck="[[spellCheck]]"\n wrap="[[wrap]]"></textarea>\n </div>\n <span id="hint" class="smart-hidden smart-hint">[[hint]]</span>\n </div>'}propertyChangedHandler(e,t,l){const a=this;switch(e){case"autoExpand":a._autoExpandUpdate();break;case"displayMode":switch(l){case"escaped":a.$.input.value=a._toEscapedDisplayMode(a.value);break;default:a.$.input.value=a.value=a._toDefaultDisplayMode(a.$.input.value)}a._autoExpandUpdate(),a._handleScrollbarsDisplay();break;case"value":switch(a._preventProgramaticValueChange?(a._userValue="escaped"===a.displayMode?a._toDefaultDisplayMode(a.$.input.value):a.$.input.value,a._programmaticValue=l):a._userValue=a._programmaticValue=l,a.displayMode){case"escaped":a.$.input.value=a._toEscapedDisplayMode(a._userValue);break;default:a.$.input.value=a._userValue}a._oldValue=t,a._autoExpandUpdate(),a._handleScrollbarsDisplay();break;case"horizontalScrollBarVisibility":case"verticalScrollBarVisibility":case"singleLine":case"wrap":case"resizable":case"placeholder":a._autoExpandUpdate(),a._handleScrollbarsDisplay();break;case"selectionEnd":case"selectionStart":a._handleSelectedText();break;case"rows":case"cols":a._updateSizeRowsCols();break;case"disabled":a._setFocusable(),a._ariaPropertyChangedHandler("disabled",l);break;case"animation":break;case"readonly":a._ariaPropertyChangedHandler("readonly",l);break;default:super.propertyChangedHandler(e,t,l)}}selection(e){const t=this;let l=t.$.input.selectionStart,a=t.$.input.selectionEnd,i=t.value;return"escaped"===t.displayMode?(i=t.$.input.value.substring(l,a),"escaped"===e?i:t._toDefaultDisplayMode(i)):"escaped"===e?(i=i.substring(l,a),t._toEscapedDisplayMode(i)):(i=i.substring(l,a),i)}select(e,t){const l=this,a=Array.from(arguments).slice(0,2);let i,n;for(let e in a)a[e]=parseInt(a[e])||0;return 2===a.length?(i=Math.min([e,t]),n=Math.max([e,t])):i=a[0],2===a.length?(i=parseInt(i),i=i>0?i<l.$.input.length?l.$.input.length:i:0,n<i?n=i:n>l.$.input.length&&(i=0),l.$.input.focus(),void l.$.input.setSelectionRange(i,n)):1===a.length?(l.$.input.focus(),void l.$.input.setSelectionRange(i,i+1)):void l.$.input.select()}_autoExpandUpdate(){const e=this,t=e.$.input,l=e.$.textBoxHidden,a=e.$.verticalScrollBar;if(!e.autoExpand)return void(t.style.height=a.style.height=l.style.height=null);const i=parseFloat(window.getComputedStyle(e).getPropertyValue("max-height"));l.style.height=0,l.value=t.value;let n=0;e.resizeTrigger&&(n=e.resizeTrigger.clientHeight,n===e.clientHeight&&(n=0)),t.style.height=a.style.height=(isNaN(i)?l.scrollHeight:Math.min((i||0)-n,l.scrollHeight))+"px"}_blurHandler(){const e=this;e._outsideAutoScroll&&clearInterval(e._outsideAutoScroll),e.removeAttribute("focus"),e._preventProgramaticValueChange=!1,e._oldValue=e.value,e.value=e._userValue||e.value,e.$.fireEvent("blur")}_createElement(){const e=this;e.$.input.id||(e.$.input.id=e.id+"Input"),e.autoFocus&&(navigator.userAgent.match(/Edge/)?setTimeout((function(){e.$.input.focus(),e.setAttribute("focus","")}),10):(e.$.input.focus(),e.setAttribute("focus","")));const t=e.$.input.innerHTML;e.value?e.$.input.innerHTML="escaped"===e.displayMode?e._toEscapedDisplayMode(e.value):e.value:t.length>0&&"escaped"===e.displayMode?(e.value=t,e.$.input.innerHTML=e._toEscapedDisplayMode(t)):t.length>0&&(e.value=t),e._setFocusable(),e._syncTextBoxContentOnInitialization(),e._scrollView=new Smart.Utilities.Scroll(e.$.input,e.$.horizontalScrollBar,e.$.verticalScrollBar),e._autoExpandUpdate(),e._handleScrollbarsDisplay(),e._initializationValue=e._oldValue=e.value,e.value.length>0?e.$.addClass("has-value"):e.$.removeClass("has-value"),e._handleHintContainer(),e.setAttribute("role","textbox"),e.setAttribute("aria-multiline",!0),e.setAttribute("aria-describedby",e.$.hint.id),e.setAttribute("aria-labelledby",e.$.label.id),e.setAttribute("aria-label",e.label||e.placeholder||e.hint||"Multiline Text Box"),e.$.verticalScrollBar.setAttribute("aria-controls",e.$.input.id),e.$.horizontalScrollBar.setAttribute("aria-controls",e.$.input.id)}_handleScrollbarsDisplay(e){const t=this,l=t.$.input;requestAnimationFrame((()=>{switch(t._autoExpandUpdate(),t.horizontalScrollBarVisibility){case"disabled":t.$container.addClass("hscroll"),t.$.horizontalScrollBar.disabled=!0;break;case"hidden":t.$container.removeClass("hscroll");break;case"visible":t.$container.addClass("hscroll"),t._scrollView.scrollWidth=l.scrollWidth-l.clientWidth,t._scrollView.scrollTo(t.$.input.scrollLeft,!0),t.$.horizontalScrollBar.disabled=!1;break;default:l.scrollWidth>l.clientWidth?(t.$container.addClass("hscroll"),t._scrollView.scrollWidth=l.scrollWidth-l.clientWidth,e&&"resize"===e.type?t.$.input.scrollLeft=t._scrollView.scrollLeft:t._scrollView.scrollTo(t.$.input.scrollLeft,!0)):t.$container.removeClass("hscroll"),t.$.horizontalScrollBar.disabled=!1}switch(t.verticalScrollBarVisibility){case"disabled":t.$container.addClass("vscroll"),t.$.verticalScrollBar.disabled=!0;break;case"hidden":t.$container.removeClass("vscroll");break;case"visible":t.$container.addClass("vscroll"),t._scrollView.scrollHeight=l.scrollHeight-l.clientHeight,t._scrollView.scrollTo(t.$.input.scrollTop),t.$.verticalScrollBar.disabled=!1;break;default:l.scrollHeight>l.clientHeight?(t.$container.addClass("vscroll"),t._scrollView.scrollHeight=l.scrollHeight-l.clientHeight,e&&"resize"===e.type?t.$.input.scrollTop=t._scrollView.scrollTop:t._scrollView.scrollTo(t.$.input.scrollTop)):t.$container.removeClass("vscroll"),t.$.verticalScrollBar.disabled=!1}}))}_focusHandler(e){const t=this;if(!t.disabled){if(e.target===t)return t.$.input.focus(),void(t._edgeSelect=!1);if(t.setAttribute("focus",""),t.selectAllOnFocus)if(navigator.userAgent.match(/Edge/)){const e=t.$.input.scrollTop;if(t._edgeSelect)return void(t._edgeSelect=!1);setTimeout((function(){t._edgeSelect=!0,t.$.input.select(),t.$.input.scrollTop=e}),5)}else t.$.input.select();t.$.fireEvent("focus")}}_getScrollLeft(e,t){const l=this;return l.rightToLeft?(Smart.Utilities.Core.Browser.Chrome?(t||(t=l.$.input.scrollWidth-l.$.input.offsetWidth),e=t-e):e*=-1,e):e}_horizontalScrollbarHandler(e){const t=this;t.disabled||"hidden"===t.horizontalScrollBarVisibility||"disabled"===t.horizontalScrollBarVisibility||(e.stopPropagation(),t.$.input.scrollLeft=t._getScrollLeft(e.detail.value))}_keyDownHandler(e){const t=this,l=e.key,a=e.shiftKey,i=e.ctrlKey,n=t.$.input.value;function r(l){let a=t.$.input.selectionStart,i=t.$.input.selectionEnd,n=t.$.input.value;e.preventDefault(),t.$.input.value=n.substring(0,a)+l+n.substring(i,n.length),t.value=t._toDefaultDisplayMode(t.$.input.value),t.$.input.selectionStart=a+2,t.$.input.selectionEnd=a+2}if(t.allowVerticalScrollbar&&t.$.input.selectionEnd>t.$.input.value.length-5&&t._scrollView.scrollTo(t._scrollView.scrollTop+(e.deltaY<0?-t.offsetHeight:t.offsetHeight)),l.indexOf("Arrow")>-1)e.stopPropagation();else switch(l){case"Enter":if("newLine"===t.enterKeyBehavior&&!i&&!a||"newLine"!==t.enterKeyBehavior&&(i||a)){"escaped"===t.displayMode&&r("\\n");break}e.preventDefault(),t._userValue="escaped"===t.displayMode?t._toDefaultDisplayMode(t.$.input.value):t.$.input.value,t.value=t._userValue,("submit"===t.enterKeyBehavior||"clearOnSubmit"===t.enterKeyBehavior||""!==n&&t._userValue!==t._oldValue)&&t.$.fireEvent("change",{oldValue:t._oldValue,value:n,type:"submit"}),"clearOnSubmit"===t.enterKeyBehavior&&(t.$.input.value=""),t._oldValue=t.value=t._toDefaultDisplayMode(t.$.input.value),t._submitted=!0,"escaped"===t.displayMode&&t.enterKeyBehavior.toLowerCase().indexOf("submit")<0&&!i&&!a&&r("\\n"),("submit"===t.enterKeyBehavior||"newLine"===t.enterKeyBehavior&&i)&&t.$.input.blur();break;case"Escape":if("none"===t.escKeyMode)return;switch(t.escKeyMode){case"none":break;case"clearValue":t.value=t.$.input.value="";break;case"previousValue":t.$.input.value="escaped"===t.displayMode?t._toEscapedDisplayMode(t._oldValue):t._oldValue}break;case" ":"escaped"===t.displayMode&&r("\\s");break;case"Backspace":if("escaped"===t.displayMode&&t.$.input.selectionStart===t.$.input.selectionEnd){let e=t.$.input.selectionStart;"\\"!==n[e-2]||"s"!==n[e-1]&&"n"!==n[e-1]||(t.$.input.value=t.$.input.value.substring(0,e-2)+t.$.input.value.substring(e-2,t.$.input.value.length),t.$.input.selectionStart=e-2)}t._scrollView&&t._handleScrollbarsDisplay()}}_keyUpHandler(e){const t=this;switch(e.key){case"ArrowLeft":case"ArrowUp":case"ArrowDown":t._handlePointerInEscapedSymbol();break;case"ArrowRight":t._handlePointerInEscapedSymbol("next")}t._userValue="escaped"===t.displayMode?t._toDefaultDisplayMode(t.$.input.value):t.$.input.value,t._submitKeyUpHandler()}_textBoxKeyDownHandler(e){const t=this,l=e.key;t._scrollView&&t._handleScrollbarsDisplay(),t.value&&t.value.length>0?t.$.addClass("has-value"):t.$.removeClass("has-value"),-1===["Enter","Escape"].indexOf(l)&&(t._preventProgramaticValueChange=!0),["ArrowLeft","ArrowUp","ArrowDown","ArrowRight"].indexOf(l)>-1&&t._scrollView.scrollTo(t.$.input.scrollTop),["PageUp","PageDown"].indexOf(l)>-1&&Smart.Utilities.Core.Browser.Chrome&&("PageUp"===e.key&&(t.$.input.setSelectionRange(0,0),t.$.input.scrollTop=0),"PageDown"===e.key&&(t.$.input.setSelectionRange(t.$.input.value.length,t.$.input.value.length),t.$.input.scrollTop=t._scrollView.verticalScrollBar.max),e.preventDefault())}_mouseWheelHandler(e){const t=this;t.disabled||t.$.verticalScrollBar.disabled||(t._scrollView.scrollTo(t._scrollView.scrollTop+(e.deltaY<0?-t.offsetHeight:t.offsetHeight)),t.$.input.scrollTop+=e.deltaY<0?-t.offsetHeight:t.offsetHeight,t.$.input.scrollTop>0&&e.preventDefault())}_syncTextBoxContentOnInitialization(){const e=this;let t;t=""===e.value?e.innerHTML:e.value,"escaped"!==e.displayMode?e.$.input.value=e.value=e._initializationValue=t:t.match(/\r\n|\n\r|\n|\r|\s|\t|\f|\r/g)?(e.value=e._initializationValue=t,e.$.input.value=e._toEscapedDisplayMode(t)):(e.value=e._initializationValue=e._toDefaultDisplayMode(t),e.$.input.value=t)}_textBoxChangeHandler(e){const t=this,l=e.clipboardData||e.originalEvent&&e.originalEvent.clipboardData||window.clipboardData,a=t.value;if("escaped"===t.displayMode){const a=t.$.input.selectionStart,i=t.$.input.selectionEnd;if(l){let n=l.getData("text"),r=t.$.input.value;e.preventDefault(),n=t._toEscapedDisplayMode(n),t.$.input.value=r.substring(0,a)+n+r.substring(i,r.length)}t.value=t._toDefaultDisplayMode(t.$.input.value)}else t.value=t.$.input.value;t._handleScrollbarsDisplay(),t.value.length>0?t.$.addClass("has-value"):t.$.removeClass("has-value"),l||t.$.fireEvent("change",{value:t.value,oldValue:a,type:"blur"}),t._handleHintContainer()}_inputTouchmoveHandler(e){const t=this;if((t._resizeStarted||t._touchmoveInside)&&e.cancelable)return e.preventDefault(),void e.stopPropagation();const l=t.$.container.classList.contains("vscroll"),a=t._touchCoords;if(!t.$.container.classList.contains("hscroll")&&!l||!a)return;const i=t._scrollView,n=e.touches[0];let r,o,s,c;t._touchCoords=[n.pageX,n.pageY],l?(r=i.scrollTop,o=i.scrollHeight,s=n.pageY,c=a[1]):(r=i.scrollLeft,o=i.scrollWidth,s=n.pageX,c=a[0]);const u=parseFloat(s.toFixed(5)),d=parseFloat(c.toFixed(5));0===r&&u>=d||r===o&&u<=d||(s!==c&&(t._touchmoveInside=!0),e.cancelable&&(e.preventDefault(),e.stopPropagation()))}_inputTouchstartHandler(e){const t=e.touches[0];this._touchCoords=[t.pageX,t.pageY]}_resizeDownHandler(){const e=this;!e.disabled&&e.resizable&&(e._resizeStarted=!0,e.$container.addClass("smart-resize"),e.readonly||e.$.input.setAttribute("readonly",""))}_resizeMoveHandler(e){const t=this;if(t.disabled||!t.resizable||!t._resizeStarted)return;const l=t.getBoundingClientRect(),a=50,i=50,n=t.rightToLeft?l.width+l.left-e.clientX:e.clientX-l.left,r=e.clientY-l.top;n>a&&(t.style.width=n+"px"),r>i&&(t.style.height=r+"px")}_updateSizeRowsCols(){const e=this;e.$.container.removeAttribute("style"),setTimeout((function(){if(!("disabled"!==e.horizontalScrollBarVisibility&&"hidden"!==e.horizontalScrollBarVisibility||"disabled"!==e.verticalScrollBarVisibility&&"hidden"!==e.verticalScrollBarVisibility))return;const t=e.getBoundingClientRect();e.$.container.style.width=t.width+"px",e.$.container.style.height=t.height+"px"}),0)}_upHandler(e){const t=this;delete t._touchCoords,delete t._touchmoveInside,t._selectionStarted=!1,t.disabled||(e.originalEvent.target!==t.$.input?(t.$container.removeClass("smart-resize"),t.readonly||t.$.input.removeAttribute("readonly"),t._resizeStarted&&t.$.input.focus(),t._resizeStarted=!1):t._handlePointerInEscapedSymbol())}_verticalScrollbarHandler(e){const t=this;t.disabled||"disabled"===t.verticalScrollBarVisibility||"hidden"===t.verticalScrollBarVisibility||(e.stopPropagation(),t.$.input.scrollTop=e.detail.value)}_documentDownHandler(e){const t=this;t._selectionStarted=!1,e.originalEvent&&t.$.input.contains(e.originalEvent.target)&&(t._selectionStarted=!0,t._selectionStartTime=new Date,t._pointerDown={pageX:e.pageX,pageY:e.pageY},t._edgeSelect=!1)}_documentSelectionOutsideHandler(e){const t=this;if(clearInterval(t._outsideAutoScroll),!t._selectionStarted)return;const l=t.$.input.getBoundingClientRect(),a=l.y+10,i=l.y+l.height-10;function n(l){const a=t.getBoundingClientRect(),i=document.documentElement,n=l?"Left":"Top";(l?a.left+i.scrollLeft-e.pageX:a.top+i.scrollTop-e.pageY)>0?(t.$.input["scroll"+n]-=10,t._scrollView["scroll"+n]-=10):(t.$.input["scroll"+n]+=10,t._scrollView["scroll"+n]+=10)}e.pageY>a&&e.pageY<i||!(new Date-t._selectionStartTime<300)&&(Math.abs(t._pointerDown.pageX-e.pageX)>=3||Math.abs(t._pointerDown.pageY-e.pageY)>=3)&&(t._outsideAutoScroll=setInterval((function(){n(),n(!0)}),10))}_selectStartHandler(){}_styleChangedHandler(){}});
|