@ni/fast-foundation 10.0.1 → 10.1.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.
|
@@ -216,6 +216,20 @@ export declare class NumberField extends FormAssociatedNumberField {
|
|
|
216
216
|
* @internal
|
|
217
217
|
*/
|
|
218
218
|
handleBlur(): void;
|
|
219
|
+
/**
|
|
220
|
+
* Sanitizes the text input by the user.
|
|
221
|
+
* @param inputText The user-input text to sanitize
|
|
222
|
+
* @returns The sanitized text, containing only valid characters for a number field
|
|
223
|
+
*/
|
|
224
|
+
protected sanitizeInput(inputText: string): string;
|
|
225
|
+
/**
|
|
226
|
+
* Synchronizes the value from the input control in the shadow DOM to the host component.
|
|
227
|
+
*/
|
|
228
|
+
protected syncValueFromInnerControl(): void;
|
|
229
|
+
/**
|
|
230
|
+
* Synchronizes the value from the host component to the input control in the shadow DOM.
|
|
231
|
+
*/
|
|
232
|
+
protected syncValueToInnerControl(): void;
|
|
219
233
|
}
|
|
220
234
|
/**
|
|
221
235
|
* Mark internal because exporting class and interface of the same name
|
|
@@ -106,7 +106,7 @@ export class NumberField extends FormAssociatedNumberField {
|
|
|
106
106
|
return;
|
|
107
107
|
}
|
|
108
108
|
if (this.control && !this.isUserInput) {
|
|
109
|
-
this.
|
|
109
|
+
this.syncValueToInnerControl();
|
|
110
110
|
}
|
|
111
111
|
super.valueChanged(previous, this.value);
|
|
112
112
|
if (previous !== undefined && !this.isUserInput) {
|
|
@@ -181,7 +181,7 @@ export class NumberField extends FormAssociatedNumberField {
|
|
|
181
181
|
super.connectedCallback();
|
|
182
182
|
this.proxy.setAttribute("type", "number");
|
|
183
183
|
this.validate();
|
|
184
|
-
this.
|
|
184
|
+
this.syncValueToInnerControl();
|
|
185
185
|
if (this.autofocus) {
|
|
186
186
|
DOM.queueUpdate(() => {
|
|
187
187
|
this.focus();
|
|
@@ -208,9 +208,9 @@ export class NumberField extends FormAssociatedNumberField {
|
|
|
208
208
|
* @internal
|
|
209
209
|
*/
|
|
210
210
|
handleTextInput() {
|
|
211
|
-
this.control.value = this.control.value
|
|
211
|
+
this.control.value = this.sanitizeInput(this.control.value);
|
|
212
212
|
this.isUserInput = true;
|
|
213
|
-
this.
|
|
213
|
+
this.syncValueFromInnerControl();
|
|
214
214
|
}
|
|
215
215
|
/**
|
|
216
216
|
* Change event handler for inner control.
|
|
@@ -246,6 +246,26 @@ export class NumberField extends FormAssociatedNumberField {
|
|
|
246
246
|
* @internal
|
|
247
247
|
*/
|
|
248
248
|
handleBlur() {
|
|
249
|
+
this.syncValueToInnerControl();
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* Sanitizes the text input by the user.
|
|
253
|
+
* @param inputText The user-input text to sanitize
|
|
254
|
+
* @returns The sanitized text, containing only valid characters for a number field
|
|
255
|
+
*/
|
|
256
|
+
sanitizeInput(inputText) {
|
|
257
|
+
return inputText.replace(/[^0-9\-+e.]/g, "");
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* Synchronizes the value from the input control in the shadow DOM to the host component.
|
|
261
|
+
*/
|
|
262
|
+
syncValueFromInnerControl() {
|
|
263
|
+
this.value = this.control.value;
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* Synchronizes the value from the host component to the input control in the shadow DOM.
|
|
267
|
+
*/
|
|
268
|
+
syncValueToInnerControl() {
|
|
249
269
|
this.control.value = this.value;
|
|
250
270
|
}
|
|
251
271
|
}
|
|
@@ -6152,6 +6152,20 @@ export declare class NumberField extends FormAssociatedNumberField {
|
|
|
6152
6152
|
* @internal
|
|
6153
6153
|
*/
|
|
6154
6154
|
handleBlur(): void;
|
|
6155
|
+
/**
|
|
6156
|
+
* Sanitizes the text input by the user.
|
|
6157
|
+
* @param inputText The user-input text to sanitize
|
|
6158
|
+
* @returns The sanitized text, containing only valid characters for a number field
|
|
6159
|
+
*/
|
|
6160
|
+
protected sanitizeInput(inputText: string): string;
|
|
6161
|
+
/**
|
|
6162
|
+
* Synchronizes the value from the input control in the shadow DOM to the host component.
|
|
6163
|
+
*/
|
|
6164
|
+
protected syncValueFromInnerControl(): void;
|
|
6165
|
+
/**
|
|
6166
|
+
* Synchronizes the value from the host component to the input control in the shadow DOM.
|
|
6167
|
+
*/
|
|
6168
|
+
protected syncValueToInnerControl(): void;
|
|
6155
6169
|
}
|
|
6156
6170
|
|
|
6157
6171
|
/**
|