@ni/spright-components 5.5.3 → 5.5.4
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.
|
@@ -4945,7 +4945,8 @@ const by="underline",yy="outline",wy="block",xy="frameless",Cy=$t`
|
|
|
4945
4945
|
>
|
|
4946
4946
|
<slot ${ie("defaultSlottedNodes")}></slot>
|
|
4947
4947
|
</label>`)
|
|
4948
|
-
class Sy extends(ov(Mv(ts))){constructor(){super(...arguments),this.appearance=by,this.fullBleed=!1,this.appearanceReadOnly=!1}connectedCallback(){super.connectedCallback(),this.control.setAttribute("role","spinbutton")}}t(
|
|
4948
|
+
class Sy extends(ov(Mv(ts))){constructor(){super(...arguments),this.appearance=by,this.fullBleed=!1,this.appearanceReadOnly=!1,this.decimalSeparator=".",this.inputFilterRegExp=this.buildFilterRegExp(this.decimalSeparator),this.langSubscriber={handleChange:()=>this.updateDecimalSeparatorAndInputFilter()}}connectedCallback(){super.connectedCallback(),this.control.setAttribute("role","spinbutton"),this.updateDecimalSeparatorAndInputFilter(),tl.subscribe(this.langSubscriber,this)}disconnectedCallback(){super.disconnectedCallback(),tl.unsubscribe(this.langSubscriber,this)}sanitizeInput(t){return t.replace(this.inputFilterRegExp,"")}syncValueFromInnerControl(){this.value="."!==this.decimalSeparator?this.control.value.replace(this.decimalSeparator,"."):this.control.value}syncValueToInnerControl(){this.control.value="."!==this.decimalSeparator?this.value.replace(".",this.decimalSeparator):this.value}updateDecimalSeparatorAndInputFilter(){const t=this.decimalSeparator
|
|
4949
|
+
this.decimalSeparator=this.getSeparatorForLanguange(tl.getValueFor(this)),this.decimalSeparator!==t&&(this.inputFilterRegExp=this.buildFilterRegExp(this.decimalSeparator),this.control.value=this.control.value.replace(t,this.decimalSeparator))}getSeparatorForLanguange(t){return Intl.NumberFormat(t).formatToParts(1.1).find((t=>"decimal"===t.type)).value}buildFilterRegExp(t){return new RegExp(`[^0-9\\-+e${t}]`,"g")}}t([ft],Sy.prototype,"appearance",void 0),t([ft({attribute:"full-bleed",mode:"boolean"})],Sy.prototype,"fullBleed",void 0),t([ft({attribute:"appearance-readonly",mode:"boolean"})],Sy.prototype,"appearanceReadOnly",void 0)
|
|
4949
4950
|
const _y=Sy.compose({baseName:"number-field",baseClass:ts,template:(t,e)=>Q`
|
|
4950
4951
|
<template class="${t=>t.readOnly?"readonly":""}">
|
|
4951
4952
|
${ky}
|
|
@@ -4969,7 +4970,7 @@ const _y=Sy.compose({baseName:"number-field",baseClass:ts,template:(t,e)=>Q`
|
|
|
4969
4970
|
?required="${t=>t.required}"
|
|
4970
4971
|
size="${t=>t.size}"
|
|
4971
4972
|
type="text"
|
|
4972
|
-
inputmode="
|
|
4973
|
+
inputmode="text"
|
|
4973
4974
|
min="${t=>t.min}"
|
|
4974
4975
|
max="${t=>t.max}"
|
|
4975
4976
|
step="${t=>t.step}"
|