@aquera/nile-elements 0.1.73-beta-1.5 → 0.1.73-beta-1.6

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/demo/index.html CHANGED
@@ -22,30 +22,30 @@
22
22
  flex: 0 0 auto;
23
23
  height: 38px;
24
24
  }
25
+
25
26
  </style>
26
27
 
27
28
  <body>
28
29
  <div>
29
- <nile-virtual-select id="vselect" [data]="arrOptions" placeholder="Please Select" multiple="true">
30
- </nile-virtual-select>
30
+ <nile-select id="vselect" [data]="arrOptions" placeholder="Please Select" enableVirtualScroll>
31
+ </nile-select>
32
+
33
+
34
+
31
35
  </div>
32
36
 
33
37
  <script>
34
- const arrOptions = Array.from({ length: 1000 }, (_, i) => ({
38
+ const arrOptions = Array.from({ length: 6 }, (_, i) => ({
35
39
  value: `option-${i + 1}`,
36
40
  label: `Option ${i + 1}`,
37
41
  }));
38
42
  document.addEventListener("DOMContentLoaded", ()=> {
39
43
  let nileVirtualSelect = document.querySelector('#vselect');
40
-
41
- // setTimeout(()=> {
42
- // nileVirtualSelect = document.querySelector('#vselect');
43
- nileVirtualSelect.value = ['option-3','option-5'];
44
- // nileVirtualSelect.values = ['option-3','option-4'];
45
-
46
- // }, 2000)
47
-
48
44
  nileVirtualSelect.data = arrOptions;
45
+ nileVirtualSelect.addEventListener('nile-scroll-end', ()=> {
46
+ console.log("nile-scroll-end event")
47
+ });
48
+
49
49
  });
50
50
  </script>
51
51
  </body>
package/dist/index.js CHANGED
@@ -4350,7 +4350,7 @@ class Hi{constructor(e){this._element=null;const t=e??window;this._node=t,e&&(th
4350
4350
  >
4351
4351
  ${pe(a)}
4352
4352
  </nile-option>
4353
- `}static shouldUseVirtualizer(e){return e.length>=50}}let rN=class extends Pe{constructor(){super(...arguments),this.formControlController=new be(this,{assumeInteractionOn:["nile-blur","nile-input"]}),this.hasSlotController=new ve(this,"help-text","label"),this.hasFocus=!1,this.displayLabel="",this.selectedOptions=[],this.oldValue="",this.scrolling=!1,this.name="",this.data=[],this.originalOptionItems=[],this.value="",this.defaultValue="",this.size="medium",this.placeholder="Select...",this.searchValue="",this.searchEnabled=!1,this.internalSearchPlaceHolder="Search...",this.disableLocalSearch=!1,this.optionsLoading=!1,this.multiple=!1,this.helpText="",this.errorMessage="",this.warning=!1,this.error=!1,this.success=!1,this.disabled=!1,this.clearable=!1,this.open=!1,this.hoist=!1,this.filled=!1,this.pill=!1,this.label="",this.placement="bottom",this.form="",this.required=!1,this.showNoResults=!1,this.noResultsMessage="No results found",this.showSelected=!1,this.blockValueChange=!1,this.noWidthSync=!1,this.maxOptionsVisible=3,this.oldMaxOptionsVisible=1,this.handleDocumentMouseDown=e=>{if(!this.open)return;const t=e.composedPath(),M=t.includes(this),i=this.popup&&t.includes(this.popup);M||i||this.hide()}}get validity(){return this.valueInput?.validity}get validationMessage(){return this.valueInput?.validationMessage??""}connectedCallback(){super.connectedCallback(),this.initializeComponent(),this.setupEventListeners(),this.updateComplete.then((()=>{this.value&&this.data.length>0&&this.selectionChanged()}))}disconnectedCallback(){this.removeOpenListeners(),this.scrollTimeout&&(clearTimeout(this.scrollTimeout),this.scrollTimeout=void 0)}updated(e){e.has("value")&&this.selectionChanged()}initializeComponent(){this.open=!1,this.emit("nile-init")}getDisplayText(e){return this.renderItemConfig?.getDisplayText?this.renderItemConfig.getDisplayText(e):e?.label||e?.name||e?.toString()||""}getItemValue(e){return this.renderItemConfig?.getValue?this.renderItemConfig.getValue(e):e?.value||e}getSearchText(e){return this.renderItemConfig?.getSearchText?this.renderItemConfig.getSearchText(e):this.getDisplayText(e)}setupEventListeners(){this.handleDocumentFocusIn=this.handleDocumentFocusIn.bind(this),this.handleDocumentKeyDown=this.handleDocumentKeyDown.bind(this),this.handleDocumentMouseDown=this.handleDocumentMouseDown.bind(this)}addOpenListeners(){document.addEventListener("focusin",this.handleDocumentFocusIn),document.addEventListener("keydown",this.handleDocumentKeyDown),document.addEventListener("mousedown",this.handleDocumentMouseDown)}removeOpenListeners(){document.removeEventListener("focusin",this.handleDocumentFocusIn),document.removeEventListener("keydown",this.handleDocumentKeyDown),document.removeEventListener("mousedown",this.handleDocumentMouseDown)}handleFocus(){this.hasFocus=!0,this.emit("nile-focus")}handleBlur(){this.hasFocus=!1,this.emit("nile-blur")}handleDocumentFocusIn(e){if(!this.open)return;const t=e.composedPath(),M=t.includes(this),i=this.popup&&t.includes(this.popup);M||i||this.hide()}handleDocumentKeyDown(e){this.shouldIgnoreKeyPress(e)||(this.isEscapeKey(e)&&this.handleEscapeKey(e),this.isEnterOrSpaceKey(e)&&this.handleEnterOrSpaceKey(e))}shouldIgnoreKeyPress(e){const t=e.target,M=null!==t.closest(".select__clear"),i=null!==t.closest("nile-icon-button");return M||i}isEscapeKey(e){return"Escape"===e.key&&this.open}handleEscapeKey(e){e.preventDefault(),e.stopPropagation(),this.hide(),this.displayInput.focus({preventScroll:!0})}isEnterOrSpaceKey(e){return"Enter"===e.key||" "===e.key}handleEnterOrSpaceKey(e){e.preventDefault(),e.stopImmediatePropagation(),this.open?this.multiple||(this.hide(),this.displayInput.focus({preventScroll:!0})):this.show()}handleFooterClick(e){e.stopPropagation(),e.preventDefault()}toggleShowSelected(e){if(e.stopPropagation(),e.preventDefault(),0!==this.selectedOptions?.length){if(this.showSelected=!this.showSelected,this.showSelected){const e=Array.isArray(this.value)?this.value:[this.value];this.data=this.originalOptionItems.filter((t=>e.includes(t.value)))}else this.data=[...this.originalOptionItems];this.requestUpdate(),this.resetScrollPosition()}}unSelectAll(){this.showSelected=!1,this.value=this.multiple?[]:"",this.data=[...this.originalOptionItems],this.selectionChanged(),this.emit("nile-change",{value:this.value,name:this.name}),this.emit("nile-clear",{value:this.multiple?this.value:"",name:this.name}),this.resetScrollPosition()}handleLabelClick(){this.displayInput.focus(),this.hide()}handleComboboxMouseDown(e){this.shouldIgnoreComboboxClick(e)||(e.preventDefault(),this.displayInput.focus({preventScroll:!0}),this.open=!this.open)}shouldIgnoreComboboxClick(e){const t=e.composedPath().some((e=>e instanceof Element&&"nile-icon-button"===e.tagName.toLowerCase()));return this.disabled||t}handleComboboxKeyDown(e){this.isEnterOrSpaceKey(e)&&(e.preventDefault(),this.open=!this.open)}handleClearClick(e){e.stopPropagation(),this.clearSelection()}clearSelection(){this.value,this.value=this.multiple?[]:"",this.selectionChanged(),this.updateComplete.then((()=>{this.nileInput({value:this.value,name:this.name}),this.nileChange({value:this.value,name:this.name}),this.emit("nile-clear")}))}handleClearMouseDown(e){e.stopPropagation()}handleOptionClick(e){const t=e.target.closest("nile-option");if(this.shouldBlockValueChange(t))return;const M=this.value;this.oldValue=M,t&&!t.disabled&&this.handleOptionSelection(t)}shouldBlockValueChange(e){return!(!this.blockValueChange||!e)&&(this.emit("nile-block-change",{value:e?.value,name:this.name}),this.hide(),!0)}handleOptionSelection(e){const t=e.value;this.multiple?this.toggleOptionSelection(t):this.setSelectedOptions(t),this.updateComplete.then((()=>this.displayInput.focus({preventScroll:!0}))),this.value!==this.oldValue&&this.updateComplete.then((()=>{this.nileInput({value:this.value,name:this.name}),this.nileChange({value:this.value,name:this.name})})),this.multiple||(this.hide(),this.displayInput.focus({preventScroll:!0}))}setSelectedOptions(e){this.value=e,this.selectionChanged()}toggleOptionSelection(e){const t=Array.isArray(this.value)?this.value:[];t.includes(e)?this.value=t.filter((t=>t!==e)):this.value=[...t,e],this.selectionChanged()}handleTagRemove(e,t){e.stopPropagation(),this.disabled||(this.removeTagFromSelection(t),this.emitTagRemovalEvent(t))}removeTagFromSelection(e){let t=this.value;Array.isArray(t)||(t=t?[t]:[]);const M=t.filter((t=>t!==e.value));this.value=M,this.selectionChanged()}emitTagRemovalEvent(e){this.updateComplete.then((()=>{this.nileInput({value:this.value,name:this.name}),this.nileChange({value:this.value,name:this.name}),this.emit("nile-tag-remove",{value:this.value,name:this.name,removedtagvalue:e.value})}))}selectionChanged(){const e=this.originalOptionItems.length>0?this.originalOptionItems:this.data;if(this.selectedOptions=ji.createVirtualOptionsFromValues(this.value,e,this.getDisplayText.bind(this),this.renderItemConfig?.getValue),this.multiple)this.placeholder&&0===this.value.length?this.displayLabel="":this.displayLabel=this.selectedOptions.length+" selected";else{const e=Array.isArray(this.value)?this.value[0]:this.value,t=this.selectedOptions[0]?.getTextLabel();this.displayLabel=t||(e??"")}this.updateValidity(),0===this.selectedOptions.length&&(this.showSelected=!1),this.calculateTotalWidthOfTags()}handleSearchFocus(){document.removeEventListener("keydown",this.handleDocumentKeyDown)}handleSearchBlur(){document.addEventListener("keydown",this.handleDocumentKeyDown)}handleSearchChange(e){this.searchValue=e.detail.value,this.emit("nile-search",{query:this.searchValue,name:this.name}),this.disableLocalSearch||(this.filterVirtualOptions(this.searchValue),this.resetScrollPosition())}handleScroll(e){const t=e.target;this.emit("nile-scroll",{scrollTop:t.scrollTop,scrollLeft:t.scrollLeft,name:this.name}),this.scrolling||(this.scrolling=!0,this.emit("nile-scroll-start",{scrollTop:t.scrollTop,scrollLeft:t.scrollLeft,name:this.name})),clearTimeout(this.scrollTimeout),this.scrollTimeout=window.setTimeout((()=>{this.scrolling&&(this.scrolling=!1)}),300);Math.ceil(t.scrollTop)>=Math.floor(t.scrollHeight-t.offsetHeight)&&this.emit("nile-scroll-end",{scrollTop:t.scrollTop,scrollLeft:t.scrollLeft,name:this.name,isAtBottom:!0})}filterVirtualOptions(e){const t=ci.filterVirtualOptions(e,this.originalOptionItems,this.data,this.getDisplayText.bind(this),this.renderItemConfig?.getSearchText);this.data=t.filteredItems,this.showNoResults=t.showNoResults,this.showSelected=!1,this.requestUpdate()}handleInvalid(e){this.formControlController.setValidity(!1),this.formControlController.emitInvalidEvent(e)}handleDisabledChange(){this.disabled&&(this.open=!1,this.handleOpenChange())}handleValueChange(){this.selectionChanged(),this.requestUpdate()}handleDataChange(){this.selectionChanged(),this.optionsLoading||0!==this.data.length?this.data.length>0&&(this.showNoResults=!1):this.showNoResults=!0,this.requestUpdate(),this.open&&this.resetScrollPosition()}handleRenderItemConfigChange(){this.value&&this.data.length>0&&(this.selectionChanged(),this.requestUpdate())}handleOptionsLoadingChange(){this.optionsLoading||0!==this.data.length||(this.showNoResults=!0),this.requestUpdate()}async handleOpenChange(){this.open&&!this.disabled?await this.handleOpen():await this.handleClose()}async handleOpen(){this.emit("nile-show",{value:this.value,name:this.name}),this.addOpenListeners(),this.showNoResults=!this.data?.length,await ct(this),this.popup.active=!0;const{keyframes:e,options:t}=yt(this,"select.show",{dir:"ltr"});await ut(this.popup.popup,e,t),this.initializeOriginalItems(),this.filterVirtualOptions(this.searchValue),this.resetScrollPosition(),this.emit("nile-after-show",{value:this.value,name:this.name})}async handleClose(){this.emit("nile-hide",{value:this.value,name:this.name}),this.removeOpenListeners(),await ct(this);const{keyframes:e,options:t}=yt(this,"select.hide",{dir:"ltr"});await ut(this.popup.popup,e,t),this.popup.active=!1,this.searchValue="",this.emit("nile-after-hide",{value:this.value,name:this.name})}initializeOriginalItems(){0===this.originalOptionItems.length&&this.data.length>0&&(this.originalOptionItems=[...this.data])}async show(){if(!this.open&&!this.disabled)return this.open=!0,St(this,"nile-after-show");this.open=!1}async hide(){if(this.open&&!this.disabled)return this.open=!1,St(this,"nile-after-hide");this.open=!1}checkValidity(){return this.valueInput.checkValidity()}getForm(){return this.formControlController.getForm()}reportValidity(){return this.valueInput.reportValidity()}setCustomValidity(e){this.valueInput.setCustomValidity(e),this.formControlController.updateValidity()}focus(e){this.displayInput.focus(e)}blur(){this.displayInput.blur()}onInputChange(e){e.stopPropagation()}render(){const e=this.hasSlotController.test("label");this.hasSlotController.test("help-text");const t=this.hasSlotController.test("label-suffix"),M=this.hasSlotController.test("custom-select"),i=!!this.label||!!e,N=this.clearable&&!this.disabled&&this.value.length>0,o=!!this.placeholder&&0===this.value.length,s=!!this.helpText,n=!!this.errorMessage;return R`
4353
+ `}static shouldUseVirtualizer(e){return e.length>=5}}let rN=class extends Pe{constructor(){super(...arguments),this.formControlController=new be(this,{assumeInteractionOn:["nile-blur","nile-input"]}),this.hasSlotController=new ve(this,"help-text","label"),this.hasFocus=!1,this.displayLabel="",this.selectedOptions=[],this.oldValue="",this.scrolling=!1,this.name="",this.data=[],this.originalOptionItems=[],this.value="",this.defaultValue="",this.size="medium",this.placeholder="Select...",this.searchValue="",this.searchEnabled=!1,this.internalSearchPlaceHolder="Search...",this.disableLocalSearch=!1,this.optionsLoading=!1,this.multiple=!1,this.helpText="",this.errorMessage="",this.warning=!1,this.error=!1,this.success=!1,this.disabled=!1,this.clearable=!1,this.open=!1,this.hoist=!1,this.filled=!1,this.pill=!1,this.label="",this.placement="bottom",this.form="",this.required=!1,this.showNoResults=!1,this.noResultsMessage="No results found",this.showSelected=!1,this.blockValueChange=!1,this.noWidthSync=!1,this.maxOptionsVisible=3,this.oldMaxOptionsVisible=1,this.handleDocumentMouseDown=e=>{if(!this.open)return;const t=e.composedPath(),M=t.includes(this),i=this.popup&&t.includes(this.popup);M||i||this.hide()}}get validity(){return this.valueInput?.validity}get validationMessage(){return this.valueInput?.validationMessage??""}connectedCallback(){super.connectedCallback(),this.initializeComponent(),this.setupEventListeners(),this.updateComplete.then((()=>{this.value&&this.data.length>0&&this.selectionChanged()}))}disconnectedCallback(){this.removeOpenListeners(),this.scrollTimeout&&(clearTimeout(this.scrollTimeout),this.scrollTimeout=void 0)}updated(e){e.has("value")&&this.selectionChanged()}initializeComponent(){this.open=!1,this.emit("nile-init")}getDisplayText(e){return this.renderItemConfig?.getDisplayText?this.renderItemConfig.getDisplayText(e):e?.label||e?.name||e?.toString()||""}getItemValue(e){return this.renderItemConfig?.getValue?this.renderItemConfig.getValue(e):e?.value||e}getSearchText(e){return this.renderItemConfig?.getSearchText?this.renderItemConfig.getSearchText(e):this.getDisplayText(e)}setupEventListeners(){this.handleDocumentFocusIn=this.handleDocumentFocusIn.bind(this),this.handleDocumentKeyDown=this.handleDocumentKeyDown.bind(this),this.handleDocumentMouseDown=this.handleDocumentMouseDown.bind(this)}addOpenListeners(){document.addEventListener("focusin",this.handleDocumentFocusIn),document.addEventListener("keydown",this.handleDocumentKeyDown),document.addEventListener("mousedown",this.handleDocumentMouseDown)}removeOpenListeners(){document.removeEventListener("focusin",this.handleDocumentFocusIn),document.removeEventListener("keydown",this.handleDocumentKeyDown),document.removeEventListener("mousedown",this.handleDocumentMouseDown)}handleFocus(){this.hasFocus=!0,this.emit("nile-focus")}handleBlur(){this.hasFocus=!1,this.emit("nile-blur")}handleDocumentFocusIn(e){if(!this.open)return;const t=e.composedPath(),M=t.includes(this),i=this.popup&&t.includes(this.popup);M||i||this.hide()}handleDocumentKeyDown(e){this.shouldIgnoreKeyPress(e)||(this.isEscapeKey(e)&&this.handleEscapeKey(e),this.isEnterOrSpaceKey(e)&&this.handleEnterOrSpaceKey(e))}shouldIgnoreKeyPress(e){const t=e.target,M=null!==t.closest(".select__clear"),i=null!==t.closest("nile-icon-button");return M||i}isEscapeKey(e){return"Escape"===e.key&&this.open}handleEscapeKey(e){e.preventDefault(),e.stopPropagation(),this.hide(),this.displayInput.focus({preventScroll:!0})}isEnterOrSpaceKey(e){return"Enter"===e.key||" "===e.key}handleEnterOrSpaceKey(e){e.preventDefault(),e.stopImmediatePropagation(),this.open?this.multiple||(this.hide(),this.displayInput.focus({preventScroll:!0})):this.show()}handleFooterClick(e){e.stopPropagation(),e.preventDefault()}toggleShowSelected(e){if(e.stopPropagation(),e.preventDefault(),0!==this.selectedOptions?.length){if(this.showSelected=!this.showSelected,this.showSelected){const e=Array.isArray(this.value)?this.value:[this.value];this.data=this.originalOptionItems.filter((t=>e.includes(t.value)))}else this.data=[...this.originalOptionItems];this.requestUpdate(),this.resetScrollPosition()}}unSelectAll(){this.showSelected=!1,this.value=this.multiple?[]:"",this.data=[...this.originalOptionItems],this.selectionChanged(),this.emit("nile-change",{value:this.value,name:this.name}),this.emit("nile-clear",{value:this.multiple?this.value:"",name:this.name}),this.resetScrollPosition()}handleLabelClick(){this.displayInput.focus(),this.hide()}handleComboboxMouseDown(e){this.shouldIgnoreComboboxClick(e)||(e.preventDefault(),this.displayInput.focus({preventScroll:!0}),this.open=!this.open)}shouldIgnoreComboboxClick(e){const t=e.composedPath().some((e=>e instanceof Element&&"nile-icon-button"===e.tagName.toLowerCase()));return this.disabled||t}handleComboboxKeyDown(e){this.isEnterOrSpaceKey(e)&&(e.preventDefault(),this.open=!this.open)}handleClearClick(e){e.stopPropagation(),this.clearSelection()}clearSelection(){this.value,this.value=this.multiple?[]:"",this.selectionChanged(),this.updateComplete.then((()=>{this.nileInput({value:this.value,name:this.name}),this.nileChange({value:this.value,name:this.name}),this.emit("nile-clear")}))}handleClearMouseDown(e){e.stopPropagation()}handleOptionClick(e){const t=e.target.closest("nile-option");if(this.shouldBlockValueChange(t))return;const M=this.value;this.oldValue=M,t&&!t.disabled&&this.handleOptionSelection(t)}shouldBlockValueChange(e){return!(!this.blockValueChange||!e)&&(this.emit("nile-block-change",{value:e?.value,name:this.name}),this.hide(),!0)}handleOptionSelection(e){const t=e.value;this.multiple?this.toggleOptionSelection(t):this.setSelectedOptions(t),this.updateComplete.then((()=>this.displayInput.focus({preventScroll:!0}))),this.value!==this.oldValue&&this.updateComplete.then((()=>{this.nileInput({value:this.value,name:this.name}),this.nileChange({value:this.value,name:this.name})})),this.multiple||(this.hide(),this.displayInput.focus({preventScroll:!0}))}setSelectedOptions(e){this.value=e,this.selectionChanged()}toggleOptionSelection(e){const t=Array.isArray(this.value)?this.value:[];t.includes(e)?this.value=t.filter((t=>t!==e)):this.value=[...t,e],this.selectionChanged()}handleTagRemove(e,t){e.stopPropagation(),this.disabled||(this.removeTagFromSelection(t),this.emitTagRemovalEvent(t))}removeTagFromSelection(e){let t=this.value;Array.isArray(t)||(t=t?[t]:[]);const M=t.filter((t=>t!==e.value));this.value=M,this.selectionChanged()}emitTagRemovalEvent(e){this.updateComplete.then((()=>{this.nileInput({value:this.value,name:this.name}),this.nileChange({value:this.value,name:this.name}),this.emit("nile-tag-remove",{value:this.value,name:this.name,removedtagvalue:e.value})}))}selectionChanged(){const e=this.originalOptionItems.length>0?this.originalOptionItems:this.data;if(this.selectedOptions=ji.createVirtualOptionsFromValues(this.value,e,this.getDisplayText.bind(this),this.renderItemConfig?.getValue),this.multiple)this.placeholder&&0===this.value.length?this.displayLabel="":this.displayLabel=this.selectedOptions.length+" selected";else{const e=Array.isArray(this.value)?this.value[0]:this.value,t=this.selectedOptions[0]?.getTextLabel();this.displayLabel=t||(e??"")}this.updateValidity(),0===this.selectedOptions.length&&(this.showSelected=!1),this.calculateTotalWidthOfTags()}handleSearchFocus(){document.removeEventListener("keydown",this.handleDocumentKeyDown)}handleSearchBlur(){document.addEventListener("keydown",this.handleDocumentKeyDown)}handleSearchChange(e){this.searchValue=e.detail.value,this.emit("nile-search",{query:this.searchValue,name:this.name}),this.disableLocalSearch||(this.filterVirtualOptions(this.searchValue),this.resetScrollPosition())}handleScroll(e){const t=e.target;this.emit("nile-scroll",{scrollTop:t.scrollTop,scrollLeft:t.scrollLeft,name:this.name}),this.scrolling||(this.scrolling=!0,this.emit("nile-scroll-start",{scrollTop:t.scrollTop,scrollLeft:t.scrollLeft,name:this.name})),clearTimeout(this.scrollTimeout),this.scrollTimeout=window.setTimeout((()=>{this.scrolling&&(this.scrolling=!1)}),300);Math.ceil(t.scrollTop)>=Math.floor(t.scrollHeight-t.offsetHeight)&&this.emit("nile-scroll-end",{scrollTop:t.scrollTop,scrollLeft:t.scrollLeft,name:this.name,isAtBottom:!0})}filterVirtualOptions(e){const t=ci.filterVirtualOptions(e,this.originalOptionItems,this.data,this.getDisplayText.bind(this),this.renderItemConfig?.getSearchText);this.data=t.filteredItems,this.showNoResults=t.showNoResults,this.showSelected=!1,this.requestUpdate()}handleInvalid(e){this.formControlController.setValidity(!1),this.formControlController.emitInvalidEvent(e)}handleDisabledChange(){this.disabled&&(this.open=!1,this.handleOpenChange())}handleValueChange(){this.selectionChanged(),this.requestUpdate()}handleDataChange(){this.selectionChanged(),this.optionsLoading||0!==this.data.length?this.data.length>0&&(this.showNoResults=!1):this.showNoResults=!0,this.requestUpdate(),this.open&&this.resetScrollPosition()}handleRenderItemConfigChange(){this.value&&this.data.length>0&&(this.selectionChanged(),this.requestUpdate())}handleOptionsLoadingChange(){this.optionsLoading||0!==this.data.length||(this.showNoResults=!0),this.requestUpdate()}async handleOpenChange(){this.open&&!this.disabled?await this.handleOpen():await this.handleClose()}async handleOpen(){this.emit("nile-show",{value:this.value,name:this.name}),this.addOpenListeners(),this.showNoResults=!this.data?.length,await ct(this),this.popup.active=!0;const{keyframes:e,options:t}=yt(this,"select.show",{dir:"ltr"});await ut(this.popup.popup,e,t),this.initializeOriginalItems(),this.filterVirtualOptions(this.searchValue),this.resetScrollPosition(),this.emit("nile-after-show",{value:this.value,name:this.name})}async handleClose(){this.emit("nile-hide",{value:this.value,name:this.name}),this.removeOpenListeners(),await ct(this);const{keyframes:e,options:t}=yt(this,"select.hide",{dir:"ltr"});await ut(this.popup.popup,e,t),this.popup.active=!1,this.searchValue="",this.emit("nile-after-hide",{value:this.value,name:this.name})}initializeOriginalItems(){0===this.originalOptionItems.length&&this.data.length>0&&(this.originalOptionItems=[...this.data])}async show(){if(!this.open&&!this.disabled)return this.open=!0,St(this,"nile-after-show");this.open=!1}async hide(){if(this.open&&!this.disabled)return this.open=!1,St(this,"nile-after-hide");this.open=!1}checkValidity(){return this.valueInput.checkValidity()}getForm(){return this.formControlController.getForm()}reportValidity(){return this.valueInput.reportValidity()}setCustomValidity(e){this.valueInput.setCustomValidity(e),this.formControlController.updateValidity()}focus(e){this.displayInput.focus(e)}blur(){this.displayInput.blur()}onInputChange(e){e.stopPropagation()}render(){const e=this.hasSlotController.test("label");this.hasSlotController.test("help-text");const t=this.hasSlotController.test("label-suffix"),M=this.hasSlotController.test("custom-select"),i=!!this.label||!!e,N=this.clearable&&!this.disabled&&this.value.length>0,o=!!this.placeholder&&0===this.value.length,s=!!this.helpText,n=!!this.errorMessage;return R`
4354
4354
  <div
4355
4355
  part="form-control"
4356
4356
  class=${Le({"form-control":!0,"form-control--small":"small"===this.size,"form-control--medium":"medium"===this.size,"form-control--large":"large"===this.size,"form-control--has-label":i,"form-control--has-help-text":s})}
@@ -1,2 +1,2 @@
1
- System.register(["lit","../virtualize-b6a2fbe0.cjs.js","lit/directives/unsafe-html.js","lit/directives/if-defined.js","lit/directive.js","lit/async-directive.js","lit/directives/repeat.js"],function(_export,_context){"use strict";var t,e,i,s,_templateObject,_templateObject2,_templateObject3,_templateObject4,_templateObject5,_templateObject6,r;function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o;}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o;},_typeof(o);}function _taggedTemplateLiteral(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}));}function _classCallCheck(a,n){if(!(a instanceof n))throw new TypeError("Cannot call a class as a function");}function _defineProperties(e,r){for(var t=0;t<r.length;t++){var o=r[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,_toPropertyKey(o.key),o);}}function _createClass(e,r,t){return r&&_defineProperties(e.prototype,r),t&&_defineProperties(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e;}function _toPropertyKey(t){var i=_toPrimitive(t,"string");return"symbol"==_typeof(i)?i:i+"";}function _toPrimitive(t,r){if("object"!=_typeof(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,r||"default");if("object"!=_typeof(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.");}return("string"===r?String:Number)(t);}return{setters:[function(_lit){t=_lit.html;},function(_virtualize001CjsJs){e=_virtualize001CjsJs.v;},function(_litDirectivesUnsafeHtmlJs){i=_litDirectivesUnsafeHtmlJs.unsafeHTML;},function(_litDirectivesIfDefinedJs){s=_litDirectivesIfDefinedJs.ifDefined;},function(_litDirectiveJs){},function(_litAsyncDirectiveJs){},function(_litDirectivesRepeatJs){}],execute:function execute(){_export("V",r=/*#__PURE__*/function(){function r(){_classCallCheck(this,r);}return _createClass(r,null,[{key:"getVirtualizedContent",value:function getVirtualizedContent(i,s,l,o,a,c,d,n,p,v,u){return t(_templateObject||(_templateObject=_taggedTemplateLiteral(["\n <div part=\"select-options\" class=\"select__options ","\">\n ","\n </div>"])),s?"select__options__search-enabled":"",n&&!v?t(_templateObject2||(_templateObject2=_taggedTemplateLiteral(["\n <div part=\"select-no-results\" class=\"select__no-results\">\n ","\n </div>\n "])),p||"No results found"):t(_templateObject3||(_templateObject3=_taggedTemplateLiteral(["\n <div\n class=\"virtualized\"\n part=\"virtualized\"\n @scroll=","\n >\n ","\n </div>\n "])),u,r.shouldUseVirtualizer(i)?t(_templateObject4||(_templateObject4=_taggedTemplateLiteral(["\n ","\n "])),e({items:i,renderItem:function renderItem(t){return r.getItemRenderFunction(t,l,o,a,c,d);},scroller:!0})):t(_templateObject5||(_templateObject5=_taggedTemplateLiteral(["\n ","\n "])),i.map(function(t){return r.getItemRenderFunction(t,l,o,a,c,d);}))));}},{key:"getItemRenderFunction",value:function getItemRenderFunction(e,_r,l,o,a,c){var d=a||_r,n=c||function(t){return(t===null||t===void 0?void 0:t.value)||t;},p=n(e),v=d(e),u=e.disabled||!1,m=e.className;var $=!1;return $=o?Array.isArray(l)&&l.includes(p):(Array.isArray(l)?l[0]:l)===p,t(_templateObject6||(_templateObject6=_taggedTemplateLiteral(["\n <nile-option \n value="," \n .selected="," \n .disabled=","\n .showCheckbox=","\n class=","\n >\n ","\n </nile-option>\n "])),p,$,u,o,s(m||void 0),i(v));}},{key:"shouldUseVirtualizer",value:function shouldUseVirtualizer(t){return t.length>=50;}}]);}());}};});
1
+ System.register(["lit","../virtualize-b6a2fbe0.cjs.js","lit/directives/unsafe-html.js","lit/directives/if-defined.js","lit/directive.js","lit/async-directive.js","lit/directives/repeat.js"],function(_export,_context){"use strict";var t,e,i,s,_templateObject,_templateObject2,_templateObject3,_templateObject4,_templateObject5,_templateObject6,r;function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o;}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o;},_typeof(o);}function _taggedTemplateLiteral(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}));}function _classCallCheck(a,n){if(!(a instanceof n))throw new TypeError("Cannot call a class as a function");}function _defineProperties(e,r){for(var t=0;t<r.length;t++){var o=r[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,_toPropertyKey(o.key),o);}}function _createClass(e,r,t){return r&&_defineProperties(e.prototype,r),t&&_defineProperties(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e;}function _toPropertyKey(t){var i=_toPrimitive(t,"string");return"symbol"==_typeof(i)?i:i+"";}function _toPrimitive(t,r){if("object"!=_typeof(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,r||"default");if("object"!=_typeof(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.");}return("string"===r?String:Number)(t);}return{setters:[function(_lit){t=_lit.html;},function(_virtualize001CjsJs){e=_virtualize001CjsJs.v;},function(_litDirectivesUnsafeHtmlJs){i=_litDirectivesUnsafeHtmlJs.unsafeHTML;},function(_litDirectivesIfDefinedJs){s=_litDirectivesIfDefinedJs.ifDefined;},function(_litDirectiveJs){},function(_litAsyncDirectiveJs){},function(_litDirectivesRepeatJs){}],execute:function execute(){_export("V",r=/*#__PURE__*/function(){function r(){_classCallCheck(this,r);}return _createClass(r,null,[{key:"getVirtualizedContent",value:function getVirtualizedContent(i,s,l,o,a,c,d,n,p,v,u){return t(_templateObject||(_templateObject=_taggedTemplateLiteral(["\n <div part=\"select-options\" class=\"select__options ","\">\n ","\n </div>"])),s?"select__options__search-enabled":"",n&&!v?t(_templateObject2||(_templateObject2=_taggedTemplateLiteral(["\n <div part=\"select-no-results\" class=\"select__no-results\">\n ","\n </div>\n "])),p||"No results found"):t(_templateObject3||(_templateObject3=_taggedTemplateLiteral(["\n <div\n class=\"virtualized\"\n part=\"virtualized\"\n @scroll=","\n >\n ","\n </div>\n "])),u,r.shouldUseVirtualizer(i)?t(_templateObject4||(_templateObject4=_taggedTemplateLiteral(["\n ","\n "])),e({items:i,renderItem:function renderItem(t){return r.getItemRenderFunction(t,l,o,a,c,d);},scroller:!0})):t(_templateObject5||(_templateObject5=_taggedTemplateLiteral(["\n ","\n "])),i.map(function(t){return r.getItemRenderFunction(t,l,o,a,c,d);}))));}},{key:"getItemRenderFunction",value:function getItemRenderFunction(e,_r,l,o,a,c){var d=a||_r,n=c||function(t){return(t===null||t===void 0?void 0:t.value)||t;},p=n(e),v=d(e),u=e.disabled||!1,m=e.className;var $=!1;return $=o?Array.isArray(l)&&l.includes(p):(Array.isArray(l)?l[0]:l)===p,t(_templateObject6||(_templateObject6=_taggedTemplateLiteral(["\n <nile-option \n value="," \n .selected="," \n .disabled=","\n .showCheckbox=","\n class=","\n >\n ","\n </nile-option>\n "])),p,$,u,o,s(m||void 0),i(v));}},{key:"shouldUseVirtualizer",value:function shouldUseVirtualizer(t){return t.length>=5;}}]);}());}};});
2
2
  //# sourceMappingURL=renderer.cjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"renderer.cjs.js","sources":["../../../src/nile-virtual-select/renderer.ts"],"sourcesContent":["/**\n * Copyright Aquera Inc 2025\n *\n * This source code is licensed under the BSD-3-Clause license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { html, type TemplateResult } from 'lit';\nimport { virtualize } from '@lit-labs/virtualizer/virtualize.js';\nimport { unsafeHTML } from 'lit/directives/unsafe-html.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\n\nexport class VirtualSelectRenderer {\n static getVirtualizedContent(\n data: any[], \n searchEnabled: boolean, \n renderItemFunction: (item: any) => string,\n value: string | string[],\n multiple: boolean,\n getDisplayText?: (item: any) => string,\n getItemValue?: (item: any) => string,\n showNoResults?: boolean,\n noResultsMessage?: string,\n optionsLoading?: boolean,\n onScroll?: (e: Event) => void\n ): TemplateResult {\n return html`\n <div part=\"select-options\" class=\"select__options ${\n searchEnabled ? 'select__options__search-enabled' : ``\n }\">\n ${showNoResults && !optionsLoading\n ? html`\n <div part=\"select-no-results\" class=\"select__no-results\">\n ${noResultsMessage || 'No results found'}\n </div>\n `\n : html`\n <div\n class=\"virtualized\"\n part=\"virtualized\"\n @scroll=${onScroll}\n >\n ${VirtualSelectRenderer.shouldUseVirtualizer(data)\n ? html`\n ${virtualize({\n items: data,\n renderItem: (item: any): TemplateResult =>\n VirtualSelectRenderer.getItemRenderFunction(item, renderItemFunction, value, multiple, getDisplayText, getItemValue),\n scroller: true,\n })}\n `\n : html`\n ${data.map((item: any) => \n VirtualSelectRenderer.getItemRenderFunction(item, renderItemFunction, value, multiple, getDisplayText, getItemValue)\n )}\n `}\n </div>\n `}\n </div>`;\n }\n\n static getItemRenderFunction(\n item: any, \n renderItemFunction: (item: any) => string, \n value: string | string[], \n multiple: boolean,\n getDisplayText?: (item: any) => string,\n getItemValue?: (item: any) => string\n ): TemplateResult {\n const displayTextFn = getDisplayText || renderItemFunction;\n const valueFn = getItemValue || ((item: any) => item?.value || item);\n \n const optionValue = valueFn(item);\n const displayText = displayTextFn(item);\n const isDisabled = item.disabled || false;\n const className = item.className;\n \n let isSelected = false;\n if (multiple) {\n isSelected = Array.isArray(value) && value.includes(optionValue);\n } else {\n isSelected = (Array.isArray(value) ? value[0] : value) === optionValue;\n }\n \n return html`\n <nile-option \n value=${optionValue} \n .selected=${isSelected} \n .disabled=${isDisabled}\n .showCheckbox=${multiple}\n class=${ifDefined(className || undefined)}\n >\n ${unsafeHTML(displayText)}\n </nile-option>\n `;\n }\n\n /**\n * Determines whether to use virtualizer based on dataset size\n * For small datasets (less than 50 items), use regular rendering for better sizing\n */\n private static shouldUseVirtualizer(data: any[]): boolean {\n return data.length >= 50;\n }\n} \n"],"names":["VirtualSelectRenderer","r","_classCallCheck","_createClass","key","value","getVirtualizedContent","data","searchEnabled","renderItemFunction","multiple","getDisplayText","getItemValue","showNoResults","noResultsMessage","optionsLoading","onScroll","html","_templateObject","_taggedTemplateLiteral","_templateObject2","_templateObject3","shouldUseVirtualizer","_templateObject4","virtualize","items","renderItem","item","getItemRenderFunction","scroller","_templateObject5","map","displayTextFn","valueFn","optionValue","displayText","isDisabled","disabled","className","isSelected","Array","isArray","includes","_templateObject6","ifDefined","undefined","unsafeHTML","length"],"mappings":"47DAYaA,CACX,kCAAAC,EAAA,EAAAC,eAAA,MAAAD,CAAA,UAAAE,YAAA,CAAAF,CAAA,QAAAG,GAAA,yBAAAC,KAAA,CAAA,QAAA,CAAAC,qBAAOA,CACLC,CACAC,CAAAA,CAAAA,CACAC,CACAJ,CAAAA,CAAAA,CACAK,CACAC,CAAAA,CAAAA,CACAC,CACAC,CAAAA,CAAAA,CACAC,CACAC,CAAAA,CAAAA,CACAC,CAEA,CAAA,CAAA,MAAOC,CAAAA,CAAI,CAAAC,eAAA,GAAAA,eAAA,CAAAC,sBAAA,sGAEPX,CAAAA,CAAgB,iCAAoC,CAAA,EAAA,CAElDK,CAAAA,EAAAA,CAAkBE,EAChBE,CAAI,CAAAG,gBAAA,GAAAA,gBAAA,CAAAD,sBAAA,8IAEEL,CAAoB,EAAA,kBAAA,EAG1BG,CAAI,CAAAI,gBAAA,GAAAA,gBAAA,CAAAF,sBAAA,gNAIUH,CAAAA,CAERhB,CAAsBsB,CAAAA,oBAAAA,CAAqBf,GACzCU,CAAI,CAAAM,gBAAA,GAAAA,gBAAA,CAAAJ,sBAAA,yDACAK,CAAAA,CAAW,CACXC,KAAAA,CAAOlB,CACPmB,CAAAA,UAAAA,CAAaC,QAAbD,CAAAA,UAAAA,CAAaC,CACX3B,QAAAA,CAAAA,CAAAA,CAAsB4B,qBAAsBD,CAAAA,CAAAA,CAAMlB,CAAoBJ,CAAA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,CACIK,CAAAA,CACAH,CAAAA,CACI1B,CAAAA,CACRkC,CAAAA,CAAUN,CAAaO,EAAAA,IAAAA,EAAAA,CAAAA,CAE7BC,CAAWX,CAAAA,CAAAA,CAAAA,CAGlB,EAMO,GAAA/B,GAAA,wBAAAC,KAAA,8BAAOiB,CAAqBf,CAAAA,CAAAA,CAClC,MAAOA,CAAAA,CAAKwC,CAAAA,MAAAA,EAAU,EACvB"}
1
+ {"version":3,"file":"renderer.cjs.js","sources":["../../../src/nile-virtual-select/renderer.ts"],"sourcesContent":["/**\n * Copyright Aquera Inc 2025\n *\n * This source code is licensed under the BSD-3-Clause license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { html, type TemplateResult } from 'lit';\nimport { virtualize } from '@lit-labs/virtualizer/virtualize.js';\nimport { unsafeHTML } from 'lit/directives/unsafe-html.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\n\nexport class VirtualSelectRenderer {\n static getVirtualizedContent(\n data: any[], \n searchEnabled: boolean, \n renderItemFunction: (item: any) => string,\n value: string | string[],\n multiple: boolean,\n getDisplayText?: (item: any) => string,\n getItemValue?: (item: any) => string,\n showNoResults?: boolean,\n noResultsMessage?: string,\n optionsLoading?: boolean,\n onScroll?: (e: Event) => void\n ): TemplateResult {\n return html`\n <div part=\"select-options\" class=\"select__options ${\n searchEnabled ? 'select__options__search-enabled' : ``\n }\">\n ${showNoResults && !optionsLoading\n ? html`\n <div part=\"select-no-results\" class=\"select__no-results\">\n ${noResultsMessage || 'No results found'}\n </div>\n `\n : html`\n <div\n class=\"virtualized\"\n part=\"virtualized\"\n @scroll=${onScroll}\n >\n ${VirtualSelectRenderer.shouldUseVirtualizer(data)\n ? html`\n ${virtualize({\n items: data,\n renderItem: (item: any): TemplateResult =>\n VirtualSelectRenderer.getItemRenderFunction(item, renderItemFunction, value, multiple, getDisplayText, getItemValue),\n scroller: true,\n })}\n `\n : html`\n ${data.map((item: any) => \n VirtualSelectRenderer.getItemRenderFunction(item, renderItemFunction, value, multiple, getDisplayText, getItemValue)\n )}\n `}\n </div>\n `}\n </div>`;\n }\n\n static getItemRenderFunction(\n item: any, \n renderItemFunction: (item: any) => string, \n value: string | string[], \n multiple: boolean,\n getDisplayText?: (item: any) => string,\n getItemValue?: (item: any) => string\n ): TemplateResult {\n const displayTextFn = getDisplayText || renderItemFunction;\n const valueFn = getItemValue || ((item: any) => item?.value || item);\n \n const optionValue = valueFn(item);\n const displayText = displayTextFn(item);\n const isDisabled = item.disabled || false;\n const className = item.className;\n \n let isSelected = false;\n if (multiple) {\n isSelected = Array.isArray(value) && value.includes(optionValue);\n } else {\n isSelected = (Array.isArray(value) ? value[0] : value) === optionValue;\n }\n \n return html`\n <nile-option \n value=${optionValue} \n .selected=${isSelected} \n .disabled=${isDisabled}\n .showCheckbox=${multiple}\n class=${ifDefined(className || undefined)}\n >\n ${unsafeHTML(displayText)}\n </nile-option>\n `;\n }\n\n /**\n * Determines whether to use virtualizer based on dataset size\n * For small datasets (less than 5 items), use regular rendering for better sizing\n */\n private static shouldUseVirtualizer(data: any[]): boolean {\n return data.length >= 5;\n }\n} \n"],"names":["VirtualSelectRenderer","r","_classCallCheck","_createClass","key","value","getVirtualizedContent","data","searchEnabled","renderItemFunction","multiple","getDisplayText","getItemValue","showNoResults","noResultsMessage","optionsLoading","onScroll","html","_templateObject","_taggedTemplateLiteral","_templateObject2","_templateObject3","shouldUseVirtualizer","_templateObject4","virtualize","items","renderItem","item","getItemRenderFunction","scroller","_templateObject5","map","displayTextFn","valueFn","optionValue","displayText","isDisabled","disabled","className","isSelected","Array","isArray","includes","_templateObject6","ifDefined","undefined","unsafeHTML","length"],"mappings":"47DAYaA,CACX,kCAAAC,EAAA,EAAAC,eAAA,MAAAD,CAAA,UAAAE,YAAA,CAAAF,CAAA,QAAAG,GAAA,yBAAAC,KAAA,CAAA,QAAA,CAAAC,qBAAOA,CACLC,CACAC,CAAAA,CAAAA,CACAC,CACAJ,CAAAA,CAAAA,CACAK,CACAC,C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AAkBe,SAAAA,CAAAA,QAAcA,CAAAA,CAAMtB,SAANsB,CAAMtB,iBAANsB,CAAMtB,CAAAA,KAAAA,GAASsB,IAEzDO,CAAcD,CAAAA,CAAAA,CAAQN,CACtBQ,CAAAA,CAAAA,CAAAA,CAAcH,CAAcL,CAAAA,CAAAA,CAAAA,CAC5BS,EAAaT,CAAKU,CAAAA,QAAAA,EAAAA,CAAY,CAC9BC,CAAAA,CAAAA,CAAYX,CAAKW,CAAAA,SAAAA,CAEvB,GAAIC,CAAAA,CAAa,CAAA,CAAA,CAAA,CAOjB,MALEA,CAAAA,CAAAA,CADE7B,CACW8B,CAAAA,KAAAA,CAAMC,QAAQpC,CAAUA,CAAAA,EAAAA,CAAAA,CAAMqC,QAASR,CAAAA,CAAAA,CAAAA,CAAAA,CAEtCM,KAAMC,CAAAA,OAAAA,CAAQpC,GAASA,CAAM,CAAA,CAAA,CAAA,CAAKA,CAAW6B,IAAAA,CAAAA,CAGtDjB,CAAI,CAAA0B,gBAAA,GAAAA,gBAAA,CAAAxB,sBAAA,gMAECe,CAAAA,CACIK,CAAAA,CACAH,CAAAA,CACI1B,CAAAA,CACRkC,CAAAA,CAAUN,CAAaO,EAAAA,IAAAA,EAAAA,CAAAA,CAE7BC,CAAWX,CAAAA,CAAAA,CAAAA,CAGlB,EAMO,GAAA/B,GAAA,wBAAAC,KAAA,8BAAOiB,CAAqBf,CAAAA,CAAAA,CAClC,MAAOA,CAAAA,CAAKwC,CAAAA,MAAAA,EAAU,CACvB"}
@@ -27,4 +27,4 @@ import{html as e}from"lit";import{v as t}from"../virtualize-a4a40d96.esm.js";imp
27
27
  >
28
28
  ${i(v)}
29
29
  </nile-option>
30
- `}static shouldUseVirtualizer(e){return e.length>=50}}export{r as V};
30
+ `}static shouldUseVirtualizer(e){return e.length>=5}}export{r as V};
@@ -10,7 +10,7 @@ export declare class VirtualSelectRenderer {
10
10
  static getItemRenderFunction(item: any, renderItemFunction: (item: any) => string, value: string | string[], multiple: boolean, getDisplayText?: (item: any) => string, getItemValue?: (item: any) => string): TemplateResult;
11
11
  /**
12
12
  * Determines whether to use virtualizer based on dataset size
13
- * For small datasets (less than 50 items), use regular rendering for better sizing
13
+ * For small datasets (less than 5 items), use regular rendering for better sizing
14
14
  */
15
15
  private static shouldUseVirtualizer;
16
16
  }
@@ -67,10 +67,10 @@ export class VirtualSelectRenderer {
67
67
  }
68
68
  /**
69
69
  * Determines whether to use virtualizer based on dataset size
70
- * For small datasets (less than 50 items), use regular rendering for better sizing
70
+ * For small datasets (less than 5 items), use regular rendering for better sizing
71
71
  */
72
72
  static shouldUseVirtualizer(data) {
73
- return data.length >= 50;
73
+ return data.length >= 5;
74
74
  }
75
75
  }
76
76
  //# sourceMappingURL=renderer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"renderer.js","sourceRoot":"","sources":["../../../src/nile-virtual-select/renderer.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,IAAI,EAAuB,MAAM,KAAK,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,qCAAqC,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAEzD,MAAM,OAAO,qBAAqB;IAChC,MAAM,CAAC,qBAAqB,CAC1B,IAAW,EACX,aAAsB,EACtB,kBAAyC,EACzC,KAAwB,EACxB,QAAiB,EACjB,cAAsC,EACtC,YAAoC,EACpC,aAAuB,EACvB,gBAAyB,EACzB,cAAwB,EACxB,QAA6B;QAE7B,OAAO,IAAI,CAAA;0DAEP,aAAa,CAAC,CAAC,CAAC,iCAAiC,CAAC,CAAC,CAAC,EACtD;UACI,aAAa,IAAI,CAAC,cAAc;YAChC,CAAC,CAAC,IAAI,CAAA;;kBAEE,gBAAgB,IAAI,kBAAkB;;aAE3C;YACH,CAAC,CAAC,IAAI,CAAA;;;;0BAIU,QAAQ;;kBAEhB,qBAAqB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UAAU,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,WAAW,CAAC;QACzE,CAAC;QAED,OAAO,IAAI,CAAA;;gBAEC,WAAW;oBACP,UAAU;oBACV,UAAU;wBACN,QAAQ;gBAChB,SAAS,CAAC,SAAS,IAAI,SAAS,CAAC;;UAEvC,UAAU,CAAC,WAAW,CAAC;;KAE5B,CAAC;IACJ,CAAC;IAED;;;OAGG;IACK,MAAM,CAAC,oBAAoB,CAAC,IAAW;QAC7C,OAAO,IAAI,CAAC,MAAM,IAAI,EAAE,CAAC;IAC3B,CAAC;CACF","sourcesContent":["/**\n * Copyright Aquera Inc 2025\n *\n * This source code is licensed under the BSD-3-Clause license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { html, type TemplateResult } from 'lit';\nimport { virtualize } from '@lit-labs/virtualizer/virtualize.js';\nimport { unsafeHTML } from 'lit/directives/unsafe-html.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\n\nexport class VirtualSelectRenderer {\n static getVirtualizedContent(\n data: any[], \n searchEnabled: boolean, \n renderItemFunction: (item: any) => string,\n value: string | string[],\n multiple: boolean,\n getDisplayText?: (item: any) => string,\n getItemValue?: (item: any) => string,\n showNoResults?: boolean,\n noResultsMessage?: string,\n optionsLoading?: boolean,\n onScroll?: (e: Event) => void\n ): TemplateResult {\n return html`\n <div part=\"select-options\" class=\"select__options ${\n searchEnabled ? 'select__options__search-enabled' : ``\n }\">\n ${showNoResults && !optionsLoading\n ? html`\n <div part=\"select-no-results\" class=\"select__no-results\">\n ${noResultsMessage || 'No results found'}\n </div>\n `\n : html`\n <div\n class=\"virtualized\"\n part=\"virtualized\"\n @scroll=${onScroll}\n >\n ${VirtualSelectRenderer.shouldUseVirtualizer(data)\n ? html`\n ${virtualize({\n items: data,\n renderItem: (item: any): TemplateResult =>\n VirtualSelectRenderer.getItemRenderFunction(item, renderItemFunction, value, multiple, getDisplayText, getItemValue),\n scroller: true,\n })}\n `\n : html`\n ${data.map((item: any) => \n VirtualSelectRenderer.getItemRenderFunction(item, renderItemFunction, value, multiple, getDisplayText, getItemValue)\n )}\n `}\n </div>\n `}\n </div>`;\n }\n\n static getItemRenderFunction(\n item: any, \n renderItemFunction: (item: any) => string, \n value: string | string[], \n multiple: boolean,\n getDisplayText?: (item: any) => string,\n getItemValue?: (item: any) => string\n ): TemplateResult {\n const displayTextFn = getDisplayText || renderItemFunction;\n const valueFn = getItemValue || ((item: any) => item?.value || item);\n \n const optionValue = valueFn(item);\n const displayText = displayTextFn(item);\n const isDisabled = item.disabled || false;\n const className = item.className;\n \n let isSelected = false;\n if (multiple) {\n isSelected = Array.isArray(value) && value.includes(optionValue);\n } else {\n isSelected = (Array.isArray(value) ? value[0] : value) === optionValue;\n }\n \n return html`\n <nile-option \n value=${optionValue} \n .selected=${isSelected} \n .disabled=${isDisabled}\n .showCheckbox=${multiple}\n class=${ifDefined(className || undefined)}\n >\n ${unsafeHTML(displayText)}\n </nile-option>\n `;\n }\n\n /**\n * Determines whether to use virtualizer based on dataset size\n * For small datasets (less than 50 items), use regular rendering for better sizing\n */\n private static shouldUseVirtualizer(data: any[]): boolean {\n return data.length >= 50;\n }\n} \n"]}
1
+ {"version":3,"file":"renderer.js","sourceRoot":"","sources":["../../../src/nile-virtual-select/renderer.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,IAAI,EAAuB,MAAM,KAAK,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,qCAAqC,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAEzD,MAAM,OAAO,qBAAqB;IAChC,MAAM,CAAC,qBAAqB,CAC1B,IAAW,EACX,aAAsB,EACtB,kBAAyC,EACzC,KAAwB,EACxB,QAA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,CAAC,IAAI,CAAC,CAAC;QACxC,MAAM,UAAU,GAAG,IAAI,CAAC,QAAQ,IAAI,KAAK,CAAC;QAC1C,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC;QAEjC,IAAI,UAAU,GAAG,KAAK,CAAC;QACvB,IAAI,QAAQ,EAAE,CAAC;YACb,UAAU,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;QACnE,CAAC;aAAM,CAAC;YACN,UAAU,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,WAAW,CAAC;QACzE,CAAC;QAED,OAAO,IAAI,CAAA;;gBAEC,WAAW;oBACP,UAAU;oBACV,UAAU;wBACN,QAAQ;gBAChB,SAAS,CAAC,SAAS,IAAI,SAAS,CAAC;;UAEvC,UAAU,CAAC,WAAW,CAAC;;KAE5B,CAAC;IACJ,CAAC;IAED;;;OAGG;IACK,MAAM,CAAC,oBAAoB,CAAC,IAAW;QAC7C,OAAO,IAAI,CAAC,MAAM,IAAI,CAAC,CAAC;IAC1B,CAAC;CACF","sourcesContent":["/**\n * Copyright Aquera Inc 2025\n *\n * This source code is licensed under the BSD-3-Clause license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { html, type TemplateResult } from 'lit';\nimport { virtualize } from '@lit-labs/virtualizer/virtualize.js';\nimport { unsafeHTML } from 'lit/directives/unsafe-html.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\n\nexport class VirtualSelectRenderer {\n static getVirtualizedContent(\n data: any[], \n searchEnabled: boolean, \n renderItemFunction: (item: any) => string,\n value: string | string[],\n multiple: boolean,\n getDisplayText?: (item: any) => string,\n getItemValue?: (item: any) => string,\n showNoResults?: boolean,\n noResultsMessage?: string,\n optionsLoading?: boolean,\n onScroll?: (e: Event) => void\n ): TemplateResult {\n return html`\n <div part=\"select-options\" class=\"select__options ${\n searchEnabled ? 'select__options__search-enabled' : ``\n }\">\n ${showNoResults && !optionsLoading\n ? html`\n <div part=\"select-no-results\" class=\"select__no-results\">\n ${noResultsMessage || 'No results found'}\n </div>\n `\n : html`\n <div\n class=\"virtualized\"\n part=\"virtualized\"\n @scroll=${onScroll}\n >\n ${VirtualSelectRenderer.shouldUseVirtualizer(data)\n ? html`\n ${virtualize({\n items: data,\n renderItem: (item: any): TemplateResult =>\n VirtualSelectRenderer.getItemRenderFunction(item, renderItemFunction, value, multiple, getDisplayText, getItemValue),\n scroller: true,\n })}\n `\n : html`\n ${data.map((item: any) => \n VirtualSelectRenderer.getItemRenderFunction(item, renderItemFunction, value, multiple, getDisplayText, getItemValue)\n )}\n `}\n </div>\n `}\n </div>`;\n }\n\n static getItemRenderFunction(\n item: any, \n renderItemFunction: (item: any) => string, \n value: string | string[], \n multiple: boolean,\n getDisplayText?: (item: any) => string,\n getItemValue?: (item: any) => string\n ): TemplateResult {\n const displayTextFn = getDisplayText || renderItemFunction;\n const valueFn = getItemValue || ((item: any) => item?.value || item);\n \n const optionValue = valueFn(item);\n const displayText = displayTextFn(item);\n const isDisabled = item.disabled || false;\n const className = item.className;\n \n let isSelected = false;\n if (multiple) {\n isSelected = Array.isArray(value) && value.includes(optionValue);\n } else {\n isSelected = (Array.isArray(value) ? value[0] : value) === optionValue;\n }\n \n return html`\n <nile-option \n value=${optionValue} \n .selected=${isSelected} \n .disabled=${isDisabled}\n .showCheckbox=${multiple}\n class=${ifDefined(className || undefined)}\n >\n ${unsafeHTML(displayText)}\n </nile-option>\n `;\n }\n\n /**\n * Determines whether to use virtualizer based on dataset size\n * For small datasets (less than 5 items), use regular rendering for better sizing\n */\n private static shouldUseVirtualizer(data: any[]): boolean {\n return data.length >= 5;\n }\n} \n"]}