@ni/spright-components 1.0.35 → 1.0.36
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.
|
@@ -9317,7 +9317,7 @@ let LT=class extends Fi{}
|
|
|
9317
9317
|
class BT extends(An(LT)){constructor(){super(...arguments),this.proxy=document.createElement("select")}}const PT=t=>!t.visuallyHidden&&!t.disabled&&!t.hidden,zT=t=>!t.visuallyHidden&&!t.hidden
|
|
9318
9318
|
class VT extends BT{constructor(){super(...arguments),this.appearance=gg,this.errorVisible=!1,this.filterMode=xg.none,this.clearable=!1,this.loadingVisible=!1,this.displayPlaceholder=!1,this.open=!1,this.listboxId=Ha("listbox-"),this.hasOverflow=!1,this.filteredOptions=[],this.filter="",this.availableViewportHeight=0,this._value="",this.forcedPosition=!1}get collapsible(){return!(this.multiple||"number"==typeof this.size)}connectedCallback(){super.connectedCallback(),this.forcedPosition=!!this.positionAttribute,this.open&&this.initializeOpenState()}get value(){return x.track(this,"value"),this._value}set value(t){const e=this._value
|
|
9319
9319
|
let n=t
|
|
9320
|
-
if(this.options?.length){const t=this.options.findIndex((t=>t.value===n)),e=this.options[this.selectedIndex]?.value??null,i=this.options[t]?.value??null;-1!==t&&e===i||(n="",this.selectedIndex=t),n=this.firstSelectedOption?.value??n}e
|
|
9320
|
+
if(this.options?.length){const t=this.options.findIndex((t=>t.value===n)),e=this.options[this.selectedIndex]?.value??null,i=this.options[t]?.value??null;-1!==t&&e===i||(n="",this.selectedIndex=t),n=this.firstSelectedOption?.value??n}e!==n&&(this._value=n,super.valueChanged(e,n),x.notify(this,"value"),this.updateDisplayValue())}get displayValue(){return x.track(this,"displayValue"),this.firstSelectedOption?.text??""}anchoredRegionChanged(t,e){this.anchoredRegion&&this.control&&(this.anchoredRegion.anchorElement=this.control)}controlChanged(t,e){this.anchoredRegion&&this.control&&(this.anchoredRegion.anchorElement=this.control)}slottedOptionsChanged(t,e){const n=this.value
|
|
9321
9321
|
this.options.forEach((t=>{const e=x.getNotifier(t)
|
|
9322
9322
|
e.unsubscribe(this,"value"),e.unsubscribe(this,"hidden"),e.unsubscribe(this,"disabled")})),t?.filter(NT).forEach((t=>{const e=x.getNotifier(t)
|
|
9323
9323
|
e.unsubscribe(this,"hidden"),e.unsubscribe(this,"visuallyHidden"),e.unsubscribe(this,"listOptions")}))
|
|
@@ -9329,7 +9329,7 @@ e.subscribe(this,"hidden"),e.subscribe(this,"visuallyHidden"),e.subscribe(this,"
|
|
|
9329
9329
|
let e=!1
|
|
9330
9330
|
if(this.open){const n=t.target.closest("option,[role=option]")
|
|
9331
9331
|
if(e=null!==n,n?.disabled)return}const n=this.selectedIndex
|
|
9332
|
-
super.clickHandler(t),this.open
|
|
9332
|
+
super.clickHandler(t),this.open&&this.selectedIndex!==n&&e&&this.updateValue(!0),this.open=this.collapsible&&!this.open}handleChange(t,e){const n=t
|
|
9333
9333
|
switch(e){case"value":this.updateValue()
|
|
9334
9334
|
break
|
|
9335
9335
|
case"selected":FT(n)&&n.selected?this.selectedIndex=this.options.indexOf(n):this.clearSelect()
|
|
@@ -9351,17 +9351,17 @@ return!this.isSameNode(e)||(this.focus(),!0)}keydownHandler(t){const e=this.sele
|
|
|
9351
9351
|
super.keydownHandler(t)
|
|
9352
9352
|
const n=t.key
|
|
9353
9353
|
if(t.ctrlKey||t.shiftKey)return!0
|
|
9354
|
-
let i=this.openActiveIndex??this.selectedIndex
|
|
9354
|
+
let i=this.openActiveIndex??this.selectedIndex,s=!1
|
|
9355
9355
|
switch(n){case Ba:if(this.open&&this.filterMode!==xg.none)break
|
|
9356
9356
|
t.preventDefault(),this.collapsible&&this.typeAheadExpired&&(this.open=!this.open),this.open||this.focus()
|
|
9357
9357
|
break
|
|
9358
9358
|
case Ra:case Aa:t.preventDefault()
|
|
9359
9359
|
break
|
|
9360
9360
|
case Ta:if(t.preventDefault(),0===this.filteredOptions.length||this.filteredOptions.every((t=>t.disabled)))return!1
|
|
9361
|
-
this.open=!this.open,this.
|
|
9361
|
+
this.open?s=!0:this.open=!0,s&&this.focus()
|
|
9362
9362
|
break
|
|
9363
9363
|
case Oa:if(!this.open){if(this.clearable)return this.clearSelect(),this.updateValue(!0),!0
|
|
9364
|
-
break}this.collapsible&&this.open&&(t.preventDefault(),this.open=!1),i=this.selectedIndex,this.focus()}return this.open||this.selectedIndex
|
|
9364
|
+
break}this.collapsible&&this.open&&(t.preventDefault(),this.open=!1),i=this.selectedIndex,this.focus()}return this.open&&!s||(this.selectedIndex!==i&&(this.selectedIndex=i),e!==this.selectedIndex&&this.updateValue(!0)),s&&(this.open=!1),!(n===Ia||n===Da)}selectedIndexChanged(t,e){this.setSelectedOptions(),this.open&&this.setActiveOption(this.selectedIndex),this.updateValue()}typeaheadBufferChanged(t,e){if(this.$fastController.isConnected){const t=this.getTypeaheadMatches()
|
|
9365
9365
|
if(t.length){const e=this.options.indexOf(t[0])
|
|
9366
9366
|
this.open&&this.filterMode!==xg.none||this.setActiveOption(e)}this.typeaheadExpired=!1}}disabledChanged(t,e){super.disabledChanged&&super.disabledChanged(t,e),this.ariaDisabled=this.disabled?"true":"false"}formResetCallback(){this.setProxyOptions(),super.setDefaultSelectedOption(),-1===this.selectedIndex&&(this.selectedIndex=0)}selectNextOption(){for(let t=(this.openActiveIndex??this.selectedIndex)+1;t<this.options.length;t++){const e=this.options[t]
|
|
9367
9367
|
if(FT(e)&&PT(e)){this.setActiveOption(t)
|