@smart-webcomponents-angular/combobox 13.0.10 → 13.1.70
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/combobox/smart-webcomponents-angular-combobox.d.ts +1 -1
- package/combobox/smart.combobox.d.ts +29 -29
- package/combobox/smart.listitem.d.ts +3 -3
- package/combobox/smart.listitemsgroup.d.ts +1 -1
- package/esm2020/combobox/smart.combobox.mjs +5 -5
- package/esm2020/combobox/smart.combobox.module.mjs +4 -4
- package/esm2020/combobox/smart.element.mjs +3 -3
- package/esm2020/combobox/smart.listitem.mjs +5 -5
- package/esm2020/combobox/smart.listitemsgroup.mjs +5 -5
- package/fesm2015/smart-webcomponents-angular-combobox.mjs +19 -19
- package/fesm2015/smart-webcomponents-angular-combobox.mjs.map +1 -1
- package/fesm2020/smart-webcomponents-angular-combobox.mjs +19 -19
- package/fesm2020/smart-webcomponents-angular-combobox.mjs.map +1 -1
- package/index.d.ts +1095 -605
- package/package.json +12 -11
- package/source/modules/smart.combobox.js +2 -2
- package/source/smart.button.js +2 -2
- package/source/smart.checkbox.js +1 -1
- 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.radiobutton.js +2 -2
- package/source/smart.scrollbar.js +1 -1
- package/styles/smart.base.css +2 -2
package/source/smart.listbox.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
|
-
/* Smart UI v13.
|
|
2
|
+
/* Smart UI v13.1.44 (2022-04-18)
|
|
3
3
|
Copyright (c) 2011-2021 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:"string"},label:{value:"",type:"string"},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-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(){super.attached(),this.ownerListBox=this.getListBox()}static get listeners(){return{mouseenter:"_itemOnMouseEnter",mouseleave:"_itemOnMouseLeave"}}ready(){super.ready();const e=this;e.setAttribute("role","option"),""!==e.label?e.innerHTML=e.label:""!==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._applyTemplate(r),o.onItemUpdated(r),r.context=t}else if("details"===e){const e=r.context;r.context=document,r.$.details.innerHTML=i,r.getListBox().onItemUpdated(r),r.context=e}else if("innerHTML"===e)r.getListBox().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"}}}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.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._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],n=s.getBoundingClientRect();if((t.indexOf(s)===t.length-1||s.parentNode.lastElementChild===s)&&e.clientY>=o.top+s.offsetTop-r.scrollTop+n.height/2&&e.clientY<=o.top-r.scrollTop+s.offsetTop+n.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+n.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 n=e.originalEvent.target;if(t.isInShadowDOM&&(n=e.originalEvent?e.originalEvent.composedPath()[0]:e.composedPath()[0]),i=!i&&n.closest?n.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 l=Smart.ListBox.DragDrop.Item,a=l.ownerListBox;l.displayMode="checkBox"===a.selectionMode||"radioButton"===a.selectionMode?a.selectionMode:"plain",a.$.fireEvent("dragEnd",{item:l,target:r,data:Smart.ListBox.DragDrop,previousContainer:s,container:i,originalEvent:e}),a._focus(l)}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 n=r>=5&&r<=15||o>=5&&o<=15;if(Smart.Utilities.Core.isMobile&&(s<300||s>1e3)&&(n=!1),n){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._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)}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 n=r.selectedValues;r.setAttribute("aria-multiselectable",-1!==["oneOrManyExtended","zeroOrMany","oneOrMany","checkBox","radioButton"].indexOf(i)),r.selectedValues=[],r.clearSelection();for(let e=0;e<n.length;e++){const t=n[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._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)}}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 n=function(t,i){return void 0!==e[t]?""+e[t]:e[i]};let l="string"==typeof e?e:n(r.displayMember,"label"),a="string"==typeof e?e:n(r.valueMember,"value"),d=n(r.groupMember,"group");return void 0===l&&(l=void 0!==t?""+t:""),s.label=s.innerHTML=""+l,void 0===a&&(a=void 0!==t?""+t:l),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.dataSource[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&&(e.__scrollHeight+=e.$.filterInput.offsetHeight),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(){for(let r=0;r<e.dataSource.length;r++){const o=e.dataSource[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}};r();let o=0;for(;t<1.5*i&&++o<5;)r()}_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),"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 n=t[s];n.dataIndex=s,n.label=n.innerHTML,n.dataItem=n,n.top||(n.top=o),n.height||(n.height=n.offsetHeight),o+=n.height,n.value||(n.value=""+s);const l=r(n,e.displayMember,"label"),a=r(n,e.valueMember,"value"),d=r(n,e.groupMember,"group");n.label!==l&&(n.label=l),n.value!==a&&(n.value=a),n.group!==d&&(n.group=d);const c=n.context;n.context=document,n.displayMode=i,n.context=c,e._alternateItem(n),n.selected&&(e.selectedIndexes.push(s),e.selectedValues.push(n.value)),e._items.push(n)}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],n=document.createElement("smart-list-items-group");n.label=s.label,n.dataIndex=o;for(let e=0;e<t[o].items.length;e++){const t=s.items[e];i.push(t),t.group=s.label,n.appendChild(t)}e._groups.push(n),r.appendChild(n)}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))){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 n=[];for(let e=0;e<i.length;e++)n.push(t.getItem(i[e]));if(n.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:n,selected:e.selected,disabled:e.disabled,index:t._indexOf(e),label:e.label,value:e.value})}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,n=document.importNode(i._template.content,!0);for(let t=0;t<r;t++){o=n.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],n=s.indexOf("label")>=0?e.label:e.value;o.innerHTML=o.innerHTML.replace(s,n)}}e.innerHTML="";for(let t=0;t<n.childNodes.length;t++)n.childNodes[t].outerHTML&&(e.innerHTML+=n.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,n;const l=function(){if(0===n.length)return r._filteredItems=[],void(t&&t());s=r._queryItems(o,r.filterMode);for(let e=0;e<n.length;e++)n[e].hidden=!0,n[e].$&&n[e].$.addClass("smart-hidden");for(let e=0;e<s.length;e++){const t=s[e];t.hidden=!1,n[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")}r._filteredItems=s,r._refreshLayout(),t&&t(),e||r._refreshSelection()};if("function"==typeof r.dataSource)if(o||i){const e=function(e){(o||i)&&r.isAttached&&(r._updateListBoxAfterQuery=function(){s=n=r._items,l()},r.clearItems(),r.insert(0,e))},t=r.dataSource(o,e);if(t){if(!o&&!i)return;r._updateListBoxAfterQuery=function(){s=n=r._items,l()},r.clearItems(),r.insert(0,t)}}else r.clearItems(),s=n=r._items,l(),r.$.fireEvent("bindingComplete");else{if(n=r._items,0===n.length)return;l()}}_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 n(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,n=s.offsetWidth+s.offsetLeft+o;return i.parentNode.removeChild(i),n}for(let e=0;e<t.length;e++){const l=t[e];if(!l.hidden)if("auto"===r){const e=i?l.label:l.textContent.trim();e.length>s.length&&(s=e)}else o=Math.max(o,n(l.label))}return"auto"===r?n(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++;for(let o=0;o<t.length;o++){const s=t[o],n=i._createItem(s);r.push(n),e>=i._items.length||0===i._items.length?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])}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)}removeAt(e){const t=this,i=t._items[e];i?(i.selected&&t.unselect(i),t.isVirtualized?t._items.splice(e,1):i.parentNode.removeChild(i),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 n=[];if(i._previouslySelectedIndexes){for(let e=0;e<i._previouslySelectedIndexes.length;e++)i.selectedIndexes.indexOf(i._previouslySelectedIndexes[e])<0&&n.push(i._items[i._previouslySelectedIndexes[e]]);delete i._previouslySelectedIndexes}return i.$.fireEvent("change",{addedItems:[e],removedItems:n,selected:e.selected,disabled:e.disabled,index:i._indexOf(e),label:e.label,value:e.value}),!0}_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._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,n;t._bindingDetails=[],t._template=e;for(let e=0;e<r;e++){for(n=[];s=o.exec(i.childNodes[e].innerHTML);)n.push(s[0]);n.length>0&&t._bindingDetails.push({childNodeIndex:e,bindingString:n})}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(),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}_mouseWheelHandler(e){const t=this;if((t.computedHorizontalScrollBarVisibility||t.computedVerticalScrollBarVisibility)&&!t.disabled&&t.computedVerticalScrollBarVisibility){const i=t.scrollTop;if(0===i&&e.deltaY<0||i===t.scrollHeight&&e.deltaY>0)return;e.stopPropagation(),e.preventDefault(),t.scrollTo(i+t._getScrollCoefficient(e,t.offsetHeight))}}_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.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.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),n=i[s];if(t._isItemInPosition(n,e))return s;n.top<e?r=s+1:n.top>e&&(o=s-1)}})(t.filterable&&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,n=s[o];let l=n?n.top:0;if(e.$.itemsInnerContainer.style.left=-e.scrollLeft+"px",e.$.itemsInnerContainer.style.top=-r+l+"px",e.isUpdating++,o>=0){const n=s.length;for(let a=o;a<n;a++){const o=s[a];if(0!==o.height){if(!(l+o.height>=r&&l<=r+t))break;{const t=e._recyclingItems[i++];if(!t)break;t.setAttribute("aria-setsize",n),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)}l+=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"},value:{value:"",type:"string"},label:{value:"",type:"string"},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-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(){super.attached(),this.ownerListBox=this.getListBox()}static get listeners(){return{mouseenter:"_itemOnMouseEnter",mouseleave:"_itemOnMouseLeave"}}ready(){super.ready();const e=this;e.setAttribute("role","option"),""!==e.label?e.innerHTML=e.label:""!==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._applyTemplate(r),o.onItemUpdated(r),r.context=t}else if("details"===e){const e=r.context;r.context=document,r.$.details.innerHTML=i,r.getListBox().onItemUpdated(r),r.context=e}else if("innerHTML"===e)r.getListBox().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"}}}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.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._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],n=s.getBoundingClientRect();if((t.indexOf(s)===t.length-1||s.parentNode.lastElementChild===s)&&e.clientY>=o.top+s.offsetTop-r.scrollTop+n.height/2&&e.clientY<=o.top-r.scrollTop+s.offsetTop+n.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+n.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 n=e.originalEvent.target;if(t.isInShadowDOM&&(n=e.originalEvent?e.originalEvent.composedPath()[0]:e.composedPath()[0]),i=!i&&n.closest?n.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 l=Smart.ListBox.DragDrop.Item,a=l.ownerListBox;l.displayMode="checkBox"===a.selectionMode||"radioButton"===a.selectionMode?a.selectionMode:"plain",a.$.fireEvent("dragEnd",{item:l,target:r,data:Smart.ListBox.DragDrop,previousContainer:s,container:i,originalEvent:e}),a._focus(l)}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 n=r>=5&&r<=15||o>=5&&o<=15;if(Smart.Utilities.Core.isMobile&&(s<300||s>1e3)&&(n=!1),n){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._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 n=r.selectedValues;r.setAttribute("aria-multiselectable",-1!==["oneOrManyExtended","zeroOrMany","oneOrMany","checkBox","radioButton"].indexOf(i)),r.selectedValues=[],r.clearSelection();for(let e=0;e<n.length;e++){const t=n[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 n=function(t,i){return void 0!==e[t]?""+e[t]:e[i]};let l="string"==typeof e?e:n(r.displayMember,"label"),a="string"==typeof e?e:n(r.valueMember,"value"),d=n(r.groupMember,"group");return void 0===l&&(l=void 0!==t?""+t:""),s.label=s.innerHTML=""+l,void 0===a&&(a=void 0!==t?""+t:l),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.dataSource[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&&(e.__scrollHeight+=e.$.filterInput.offsetHeight),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(){for(let r=0;r<e.dataSource.length;r++){const o=e.dataSource[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}};r();let o=0;for(;t<1.5*i&&++o<5;)r()}_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),"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 n=t[s];n.dataIndex=s,n.label=n.innerHTML,n.dataItem=n,n.top||(n.top=o),n.height||(n.height=n.offsetHeight),o+=n.height,n.value||(n.value=""+s);const l=r(n,e.displayMember,"label"),a=r(n,e.valueMember,"value"),d=r(n,e.groupMember,"group");n.label!==l&&(n.label=l),n.value!==a&&(n.value=a),n.group!==d&&(n.group=d);const c=n.context;n.context=document,n.displayMode=i,n.context=c,e._alternateItem(n),n.selected&&(e.selectedIndexes.push(s),e.selectedValues.push(n.value)),e._items.push(n)}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],n=document.createElement("smart-list-items-group");n.label=s.label,n.dataIndex=o;for(let e=0;e<t[o].items.length;e++){const t=s.items[e];i.push(t),t.group=s.label,n.appendChild(t)}e._groups.push(n),r.appendChild(n)}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))){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 n=[];for(let e=0;e<i.length;e++)n.push(t.getItem(i[e]));if(n.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:n,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,n=document.importNode(i._template.content,!0);for(let t=0;t<r;t++){o=n.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],n=s.indexOf("label")>=0?e.label:e.value;o.innerHTML=o.innerHTML.replace(s,n)}}e.innerHTML="";for(let t=0;t<n.childNodes.length;t++)n.childNodes[t].outerHTML&&(e.innerHTML+=n.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,n;const l=function(){if(0===n.length)return r._filteredItems=[],void(t&&t());s=r._queryItems(o,r.filterMode);for(let e=0;e<n.length;e++)n[e].hidden=!0,n[e].$&&n[e].$.addClass("smart-hidden");for(let e=0;e<s.length;e++){const t=s[e];t.hidden=!1,n[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")}r._filteredItems=s,r._refreshLayout(),t&&t(),e||r._refreshSelection()};if("function"==typeof r.dataSource)if(o||i){const e=function(e){(o||i)&&r.isAttached&&(r._updateListBoxAfterQuery=function(){s=n=r._items,l()},r.clearItems(),r.insert(0,e))},t=r.dataSource(o,e);if(t){if(!o&&!i)return;r._updateListBoxAfterQuery=function(){s=n=r._items,l()},r.clearItems(),r.insert(0,t)}}else r.clearItems(),s=n=r._items,l(),r.$.fireEvent("bindingComplete");else{if(n=r._items,0===n.length)return;l()}}_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 n(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,n=s.offsetWidth+s.offsetLeft+o;return i.parentNode.removeChild(i),n}for(let e=0;e<t.length;e++){const l=t[e];if(!l.hidden)if("auto"===r){const e=i?l.label:l.textContent.trim();e.length>s.length&&(s=e)}else o=Math.max(o,n(l.label))}return"auto"===r?n(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++;for(let o=0;o<t.length;o++){const s=t[o],n=i._createItem(s);r.push(n),e>=i._items.length||0===i._items.length?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])}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)}removeAt(e){const t=this,i=t._items[e];i?(i.selected&&t.unselect(i),t.isVirtualized?t._items.splice(e,1):i.parentNode.removeChild(i),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 n=[];if(i._previouslySelectedIndexes){for(let e=0;e<i._previouslySelectedIndexes.length;e++)i.selectedIndexes.indexOf(i._previouslySelectedIndexes[e])<0&&n.push(i._items[i._previouslySelectedIndexes[e]]);delete i._previouslySelectedIndexes}return i.$.fireEvent("change",{addedItems:[e],removedItems:n,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,n;t._bindingDetails=[],t._template=e;for(let e=0;e<r;e++){for(n=[];s=o.exec(i.childNodes[e].innerHTML);)n.push(s[0]);n.length>0&&t._bindingDetails.push({childNodeIndex:e,bindingString:n})}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(),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}_mouseWheelHandler(e){const t=this;if((t.computedHorizontalScrollBarVisibility||t.computedVerticalScrollBarVisibility)&&!t.disabled&&t.computedVerticalScrollBarVisibility){const i=t.scrollTop;if(0===i&&e.deltaY<0||i===t.scrollHeight&&e.deltaY>0)return;e.stopPropagation(),e.preventDefault(),t.scrollTo(i+t._getScrollCoefficient(e,t.offsetHeight))}}_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.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.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),n=i[s];if(t._isItemInPosition(n,e))return s;n.top<e?r=s+1:n.top>e&&(o=s-1)}})(t.filterable&&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,n=s[o];let l=n?n.top:0;if(e.$.itemsInnerContainer.style.left=-e.scrollLeft+"px",e.$.itemsInnerContainer.style.top=-r+l+"px",e.isUpdating++,o>=0){const n=s.length;for(let a=o;a<n;a++){const o=s[a];if(0!==o.height){if(!(l+o.height>=r&&l<=r+t))break;{const t=e._recyclingItems[i++];if(!t)break;t.setAttribute("aria-setsize",n),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)}l+=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)}}});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
|
-
/* Smart UI v13.
|
|
2
|
+
/* Smart UI v13.1.44 (2022-04-18)
|
|
3
3
|
Copyright (c) 2011-2021 jQWidgets.
|
|
4
4
|
License: https://htmlelements.com/license/ */ //
|
|
5
5
|
|
|
6
|
-
Smart("smart-radio-button",class extends Smart.ToggleButton{static get properties(){return{checkMode:{value:"both",allowedValues:["both","input","label"],type:"string"},type:{value:"radio",type:"string",defaultReflectToAttribute:!0,readonly:!0},groupName:{value:"",type:"string"}}}template(){return"<div id='container' class='smart-container'>\n <div class ='smart-overlay'></div>\n <span id='radioButtonInput' class ='smart-input'></span>\n <span id='radioButtonLabel' inner-h-t-m-l='[[innerHTML]]' class ='smart-label'><content></content></span>\n <input id='hiddenInput' class ='smart-hidden-input' type='hidden'>\n </div>"}static get listeners(){return{down:"_downHandler","document.up":"_documentUpHandler",mouseenter:"_elementMouseEnterHandler","radioButtonInput.mouseenter":"_radioMouseEnterHandler","radioButtonInput.mouseleave":"_radioMouseLeaveHandler",focus:"_focusHandler",blur:"_blurHandler"}}static get styleUrls(){return["smart.toggle.css"]}_radioMouseEnterHandler(){this.$.setAttributeValue("hover",!0)}_radioMouseLeaveHandler(){this.$.setAttributeValue("hover",!1)}_focusHandler(){this.$.setAttributeValue("focus",!0)}_blurHandler(){this.$.setAttributeValue("focus",!1)}_mouseEnterHandler(){this.$.setAttributeValue("hover",!0)}_mouseLeaveHandler(){this.$.setAttributeValue("hover",!1)}ready(){const e=this;super.ready(),e.classList.add("smart-toggle-box"),e._handleMultipleCheckedInstances(),e._updateHidenInputNameAndValue()}_downHandler(e){const t=this,
|
|
6
|
+
Smart("smart-radio-button",class extends Smart.ToggleButton{static get properties(){return{checkMode:{value:"both",allowedValues:["both","input","label"],type:"string"},type:{value:"radio",type:"string",defaultReflectToAttribute:!0,readonly:!0},groupName:{value:"",type:"string"}}}template(){return"<div id='container' class='smart-container'>\n <div class ='smart-overlay'></div>\n <span id='radioButtonInput' class ='smart-input'></span>\n <span id='radioButtonLabel' inner-h-t-m-l='[[innerHTML]]' class ='smart-label'><content></content></span>\n <input id='hiddenInput' class ='smart-hidden-input' type='hidden'>\n </div>"}static get listeners(){return{down:"_downHandler","document.up":"_documentUpHandler",mouseenter:"_elementMouseEnterHandler","radioButtonInput.mouseenter":"_radioMouseEnterHandler","radioButtonInput.mouseleave":"_radioMouseLeaveHandler",focus:"_focusHandler",blur:"_blurHandler"}}static get styleUrls(){return["smart.toggle.css"]}_radioMouseEnterHandler(){this.$.setAttributeValue("hover",!0)}_radioMouseLeaveHandler(){this.$.setAttributeValue("hover",!1)}_focusHandler(){this.$.setAttributeValue("focus",!0)}_blurHandler(){this.$.setAttributeValue("focus",!1)}_mouseEnterHandler(){this.$.setAttributeValue("hover",!0)}_mouseLeaveHandler(){this.$.setAttributeValue("hover",!1)}ready(){const e=this;super.ready(),e.classList.add("smart-toggle-box"),e._handleMultipleCheckedInstances(),e._updateHidenInputNameAndValue(),e._updateGroupValue()}_downHandler(e){const t=this,a=t.enableShadowDOM?e.originalEvent.composedPath()[0]:e.originalEvent.target;if(!(t.disabled||t.readonly||"input"===t.checkMode&&a!==t.$.radioButtonInput||"label"===t.checkMode&&a!==t.$.radioButtonLabel)){if(t.$.setAttributeValue("active",!0),t.hasRippleAnimation){const e=t.$.radioButtonInput.getBoundingClientRect(),a=window.scrollX||window.pageXOffset,n=window.scrollY||window.pageYOffset;Smart.Utilities.Animation.Ripple.animate(t.$.radioButtonInput,e.left+e.width/2+a,e.top+e.height/2+n)}t._preventAction?t._preventAction=!1:("release"!==t.clickMode&&"pressAndRelease"!==t.clickMode||(t._pressed=!0),"press"!==t.clickMode&&"pressAndRelease"!==t.clickMode||("pressAndRelease"===t.clickMode&&(""===t.groupName?t._checkedBeforeChange=t.parentNode.querySelector("smart-radio-button[checked]"):t._checkedBeforeChange=document.querySelector('smart-radio-button[group-name="'+t.groupName+'"][checked]')),t._handleMouseInteraction()))}}_elementMouseEnterHandler(){const e=this;"hover"!==e.clickMode||e.disabled||e.readonly||e._handleMouseInteraction()}_documentUpHandler(e){const t=this,a=t.enableShadowDOM?e.originalEvent.composedPath()[0]:e.originalEvent.target;!t._pressed||t.disabled||t.readonly||"input"===t.checkMode&&a!==t.$.radioButtonInput||"label"===t.checkMode&&a!==t.$.radioButtonLabel||"pointercancel"===e.originalEvent.type||("release"===t.clickMode?t._handleMouseInteraction():(null===t._checkedBeforeChange?(t.$.fireEvent("change",{value:!1,oldValue:!0,changeType:"pointer"}),t.$.fireEvent("uncheckValue",{changeType:"pointer"}),t.checked=!1):t._checkedBeforeChange._changeCheckState("pointer"),t.focus(),t._updateHidenInputNameAndValue()),t.$.setAttributeValue("active",!1),t._pressed=!1)}_handleMouseInteraction(){const e=this;e._handleTextSelection(),e._changeCheckState("pointer"),e.focus(),e._updateHidenInputNameAndValue()}_handleMultipleCheckedInstances(){const e=Array.from(document.querySelectorAll('smart-radio-button[group-name="'+this.groupName+'"][checked]')),t=Array.from(document.querySelectorAll('smart-ui-radio-button[group-name="'+this.groupName+'"][checked]')),a=e.length+t.length;a<2||e.concat(...t).forEach(((e,t)=>t<a-1&&(e.checked=!1)))}_changeCheckState(e){const t=this;let a=document.querySelectorAll('smart-radio-button[group-name="'+t.groupName+'"]'),n=document.querySelectorAll('smart-ui-radio-button[group-name="'+t.groupName+'"]'),o=Array.from(a).concat(...n);if(!0===t.checked&&"api"===e||!1===t.checked)if(o.length>0)t._changeCheckStateInGroup(o,e);else{let r=t.parentNode;t.getRootNode().host?(r=t.getRootNode().host.parentNode,a=r.querySelectorAll("smart-radio-button:not([group-name])"),n=r.querySelectorAll("smart-ui-radio-button:not([group-name])"),o=Array.from(a).concat(...n)):o=r.querySelectorAll("smart-radio-button:not([group-name])"),t._changeCheckStateInGroup(o,e)}}_updateGroupValue(){const e=this;if(e.dataset.target){const t=document.querySelector(e.dataset.target);if(t&&e.checked){const a=e.dataset.property,n=e.dataset.value;if(a&&void 0!==t[a]){let e=n;"true"===e&&(e=!0),"false"===e&&(e=!1),t[a]=e}else e.name?(t.value=e.name,e.id&&t.setAttribute("data-id",e.id)):e.id&&(t.value=e.id),e._targetDispatchTimer&&clearTimeout(e._targetDispatchTimer),e._targetDispatchTimer=setTimeout((()=>{t.dispatchEvent(new Event("change"))}),100)}}}_changeCheckStateInGroup(e,t){const a=this,n=a.getRootNode().host?a.getRootNode().host:a;for(let t=0;t<e.length;t++)e[t]._isUpdating=!0,e[t]===n?n.checked=!0:e[t].checked&&(e[t].checked=!1),e[t]._isUpdating=!1;n.nativeElement?(n.nativeElement.$.fireEvent("change",{value:!0,oldValue:!1,changeType:t}),n.nativeElement.$.fireEvent("checkValue",{changeType:t})):(n.$.fireEvent("change",{value:!0,oldValue:!1,changeType:t}),n.$.fireEvent("checkValue",{changeType:t})),a._updateGroupValue()}propertyChangedHandler(e,t,a){const n=this;switch(e){case"value":n._updateHidenInputNameAndValue();break;case"checked":n._isUpdating||n._changeCheckState("api"),n._updateHidenInputNameAndValue();break;case"name":n._updateHidenInputName();break;default:super.propertyChangedHandler(e,t,a)}}});
|