@ni/spright-components 1.0.15 → 1.0.16
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.
|
@@ -9049,14 +9049,15 @@ let bT=class extends Ii{}
|
|
|
9049
9049
|
class yT extends($n(bT)){constructor(){super(...arguments),this.proxy=document.createElement("select")}}const wT=e=>!e.visuallyHidden&&!e.disabled&&!e.hidden,xT=e=>!e.visuallyHidden&&!e.hidden
|
|
9050
9050
|
class CT extends yT{constructor(){super(...arguments),this.appearance=Gm,this.errorVisible=!1,this.filterMode=Ym.none,this.clearable=!1,this.displayPlaceholder=!1,this.open=!1,this.listboxId=xa("listbox-"),this.hasOverflow=!1,this.filteredOptions=[],this.filter="",this.maxHeight=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 m.track(this,"value"),this._value}set value(e){const t=this._value
|
|
9051
9051
|
let n=e
|
|
9052
|
-
if(this.options?.length){const e=this.options.findIndex((e=>e.value===n)),t=this.options[this.selectedIndex]?.value??null,i=this.options[e]?.value??null;-1!==e&&t===i||(n="",this.selectedIndex=e),n=this.firstSelectedOption?.value??n}t===n||this.open&&this.selectedIndex<0||(this._value=n,super.valueChanged(t,n),m.notify(this,"value"),this.updateDisplayValue())}get displayValue(){return m.track(this,"displayValue"),this.firstSelectedOption?.text??""}anchoredRegionChanged(e,t){this.anchoredRegion&&this.control&&(this.anchoredRegion.anchorElement=this.control)}controlChanged(e,t){this.anchoredRegion&&this.control&&(this.anchoredRegion.anchorElement=this.control)}slottedOptionsChanged(e,t){
|
|
9052
|
+
if(this.options?.length){const e=this.options.findIndex((e=>e.value===n)),t=this.options[this.selectedIndex]?.value??null,i=this.options[e]?.value??null;-1!==e&&t===i||(n="",this.selectedIndex=e),n=this.firstSelectedOption?.value??n}t===n||this.open&&this.selectedIndex<0||(this._value=n,super.valueChanged(t,n),m.notify(this,"value"),this.updateDisplayValue())}get displayValue(){return m.track(this,"displayValue"),this.firstSelectedOption?.text??""}anchoredRegionChanged(e,t){this.anchoredRegion&&this.control&&(this.anchoredRegion.anchorElement=this.control)}controlChanged(e,t){this.anchoredRegion&&this.control&&(this.anchoredRegion.anchorElement=this.control)}slottedOptionsChanged(e,t){const n=this.value
|
|
9053
|
+
this.options.forEach((e=>{const t=m.getNotifier(e)
|
|
9053
9054
|
t.unsubscribe(this,"value"),t.unsubscribe(this,"hidden"),t.unsubscribe(this,"disabled")})),e?.filter(vT).forEach((e=>{const t=m.getNotifier(e)
|
|
9054
9055
|
t.unsubscribe(this,"hidden"),t.unsubscribe(this,"visuallyHidden"),t.unsubscribe(this,"listOptions")}))
|
|
9055
|
-
const
|
|
9056
|
-
|
|
9056
|
+
const i=this.getSlottedOptions(t)
|
|
9057
|
+
super.slottedOptionsChanged(e,i),i.forEach((e=>{const t=m.getNotifier(e)
|
|
9057
9058
|
t.subscribe(this,"value"),t.subscribe(this,"hidden"),t.subscribe(this,"disabled")})),t?.filter(vT).forEach((e=>{this.updateAdjacentSeparatorState(e)
|
|
9058
9059
|
const t=m.getNotifier(e)
|
|
9059
|
-
t.subscribe(this,"hidden"),t.subscribe(this,"visuallyHidden"),t.subscribe(this,"listOptions")})),this.setProxyOptions(),this.updateValue(),this.filterOptions()}clickHandler(e){if(this.disabled)return
|
|
9060
|
+
t.subscribe(this,"hidden"),t.subscribe(this,"visuallyHidden"),t.subscribe(this,"listOptions")})),this.setProxyOptions(),this.updateValue(),this.filterOptions(),n&&(this.value=n)}clickHandler(e){if(this.disabled)return
|
|
9060
9061
|
let t=!1
|
|
9061
9062
|
if(this.open){const n=e.target.closest("option,[role=option]")
|
|
9062
9063
|
if(t=null!==n,n?.disabled)return}const n=this.selectedIndex
|