@ni/nimble-components 33.12.1 → 34.0.0
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/dist/all-components-bundle.js +43 -1
- package/dist/all-components-bundle.js.map +1 -1
- package/dist/all-components-bundle.min.js +3 -2
- package/dist/all-components-bundle.min.js.map +1 -1
- package/dist/esm/number-field/index.d.ts +10 -0
- package/dist/esm/number-field/index.js +43 -0
- package/dist/esm/number-field/index.js.map +1 -1
- package/dist/esm/number-field/template.js +1 -1
- package/dist/esm/number-field/template.js.map +1 -1
- package/dist/esm/number-field/testing/number-field.pageobject.d.ts +23 -0
- package/dist/esm/number-field/testing/number-field.pageobject.js +38 -0
- package/dist/esm/number-field/testing/number-field.pageobject.js.map +1 -0
- package/package.json +2 -2
|
@@ -26827,7 +26827,7 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
26827
26827
|
?required="${x => x.required}"
|
|
26828
26828
|
size="${x => x.size}"
|
|
26829
26829
|
type="text"
|
|
26830
|
-
inputmode="
|
|
26830
|
+
inputmode="text"
|
|
26831
26831
|
min="${x => x.min}"
|
|
26832
26832
|
max="${x => x.max}"
|
|
26833
26833
|
step="${x => x.step}"
|
|
@@ -26889,11 +26889,53 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
26889
26889
|
this.appearance = NumberFieldAppearance.underline;
|
|
26890
26890
|
this.fullBleed = false;
|
|
26891
26891
|
this.appearanceReadOnly = false;
|
|
26892
|
+
this.decimalSeparator = '.';
|
|
26893
|
+
this.inputFilterRegExp = this.buildFilterRegExp(this.decimalSeparator);
|
|
26894
|
+
this.langSubscriber = {
|
|
26895
|
+
handleChange: () => this.updateDecimalSeparatorAndInputFilter()
|
|
26896
|
+
};
|
|
26892
26897
|
}
|
|
26893
26898
|
connectedCallback() {
|
|
26894
26899
|
super.connectedCallback();
|
|
26895
26900
|
// This is a workaround for FAST issue: https://github.com/microsoft/fast/issues/6148
|
|
26896
26901
|
this.control.setAttribute('role', 'spinbutton');
|
|
26902
|
+
this.updateDecimalSeparatorAndInputFilter();
|
|
26903
|
+
lang.subscribe(this.langSubscriber, this);
|
|
26904
|
+
}
|
|
26905
|
+
disconnectedCallback() {
|
|
26906
|
+
super.disconnectedCallback();
|
|
26907
|
+
lang.unsubscribe(this.langSubscriber, this);
|
|
26908
|
+
}
|
|
26909
|
+
sanitizeInput(inputText) {
|
|
26910
|
+
return inputText.replace(this.inputFilterRegExp, '');
|
|
26911
|
+
}
|
|
26912
|
+
// this.value <-- this.control.value
|
|
26913
|
+
syncValueFromInnerControl() {
|
|
26914
|
+
this.value = this.decimalSeparator !== '.'
|
|
26915
|
+
? this.control.value.replace(this.decimalSeparator, '.')
|
|
26916
|
+
: this.control.value;
|
|
26917
|
+
}
|
|
26918
|
+
// this.value --> this.control.value
|
|
26919
|
+
syncValueToInnerControl() {
|
|
26920
|
+
this.control.value = this.decimalSeparator !== '.'
|
|
26921
|
+
? this.value.replace('.', this.decimalSeparator)
|
|
26922
|
+
: this.value;
|
|
26923
|
+
}
|
|
26924
|
+
updateDecimalSeparatorAndInputFilter() {
|
|
26925
|
+
const previousSeparator = this.decimalSeparator;
|
|
26926
|
+
this.decimalSeparator = this.getSeparatorForLanguange(lang.getValueFor(this));
|
|
26927
|
+
if (this.decimalSeparator !== previousSeparator) {
|
|
26928
|
+
this.inputFilterRegExp = this.buildFilterRegExp(this.decimalSeparator);
|
|
26929
|
+
this.control.value = this.control.value.replace(previousSeparator, this.decimalSeparator);
|
|
26930
|
+
}
|
|
26931
|
+
}
|
|
26932
|
+
getSeparatorForLanguange(language) {
|
|
26933
|
+
return Intl.NumberFormat(language)
|
|
26934
|
+
.formatToParts(1.1)
|
|
26935
|
+
.find(x => x.type === 'decimal').value;
|
|
26936
|
+
}
|
|
26937
|
+
buildFilterRegExp(decimalSeparator) {
|
|
26938
|
+
return new RegExp(`[^0-9\\-+e${decimalSeparator}]`, 'g');
|
|
26897
26939
|
}
|
|
26898
26940
|
}
|
|
26899
26941
|
__decorate([
|