@quadrel-enterprise-ui/framework 20.27.3-beta.234.1 → 20.27.3-beta.236.1

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.
@@ -11767,41 +11767,47 @@ class QdInputComponent {
11767
11767
  if (input?.validity?.badInput)
11768
11768
  return;
11769
11769
  const value = event.target.value;
11770
- if (this.inputType === 'number' && value && !this.numberInputService.isValidNumber(value)) {
11771
- this.control?.setErrors({
11772
- ...this.control.errors,
11773
- invalidCharacters: this.numberInputService.invalidCharactersErrorKey
11774
- });
11770
+ if (this.inputType === 'number' && value && !this.handleNumberInput(value))
11775
11771
  return;
11776
- }
11777
- if (this.inputType === 'number' && value) {
11778
- const valueWithoutGroups = value.split(this.numberInputService.groupSeparator).join('');
11779
- const filtered = this.numberInputService.filterValue(valueWithoutGroups);
11780
- const hasInvalidChars = filtered !== valueWithoutGroups;
11781
- if (hasInvalidChars) {
11782
- this._value = { ...this._value, value: filtered };
11783
- if (this.control) {
11784
- this.control.setErrors({
11785
- ...this.control.errors,
11786
- invalidCharacters: this.numberInputService.invalidCharactersErrorKey
11787
- });
11788
- }
11789
- this._isUserTyped = true;
11790
- this._onTouch();
11791
- this.emitValue();
11792
- return;
11793
- }
11794
- if (this.control?.errors?.['invalidCharacters']) {
11795
- const remainingErrors = Object.fromEntries(Object.entries(this.control.errors).filter(([key]) => key !== 'invalidCharacters'));
11796
- this.control.setErrors(Object.keys(remainingErrors).length ? remainingErrors : null);
11797
- }
11798
- }
11799
11772
  this._isUserTyped = true;
11800
11773
  this._value = { ...this._value, value };
11774
+ this._displayValue = String(value ?? '');
11801
11775
  this.loadOptionsForTypedValue(value);
11802
11776
  this.emitValue();
11803
11777
  this._onTouch();
11804
11778
  }
11779
+ handleNumberInput(value) {
11780
+ if (!this.numberInputService.isValidNumber(value)) {
11781
+ this.setInvalidCharactersError();
11782
+ return false;
11783
+ }
11784
+ const valueWithoutGroups = value.split(this.numberInputService.groupSeparator).join('');
11785
+ const filtered = this.numberInputService.filterValue(valueWithoutGroups);
11786
+ if (filtered !== valueWithoutGroups) {
11787
+ this._value = { ...this._value, value: filtered };
11788
+ this.setInvalidCharactersError();
11789
+ this._isUserTyped = true;
11790
+ this._onTouch();
11791
+ this.emitValue();
11792
+ return false;
11793
+ }
11794
+ this.clearInvalidCharactersError();
11795
+ return true;
11796
+ }
11797
+ setInvalidCharactersError() {
11798
+ if (!this.control)
11799
+ return;
11800
+ this.control.setErrors({
11801
+ ...this.control.errors,
11802
+ invalidCharacters: this.numberInputService.invalidCharactersErrorKey
11803
+ });
11804
+ }
11805
+ clearInvalidCharactersError() {
11806
+ if (!this.control?.errors?.['invalidCharacters'])
11807
+ return;
11808
+ const remainingErrors = Object.fromEntries(Object.entries(this.control.errors).filter(([key]) => key !== 'invalidCharacters'));
11809
+ this.control.setErrors(Object.keys(remainingErrors).length ? remainingErrors : null);
11810
+ }
11805
11811
  handleOptionSelected(option) {
11806
11812
  this._value = { ...this._value, value: option.i18n };
11807
11813
  this.popover?.close();