osl-base-extended 1.1.34 → 1.1.36

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.
@@ -999,7 +999,7 @@ class Oslinput {
999
999
  get inputType() {
1000
1000
  if (this.type === 'password')
1001
1001
  return this.showPassword ? 'text' : 'password';
1002
- if (this.decimalPortion !== null)
1002
+ if (this.decimalPortion !== null || this.type === 'int')
1003
1003
  return 'text';
1004
1004
  return this.type;
1005
1005
  }
@@ -1070,6 +1070,12 @@ class Oslinput {
1070
1070
  event.preventDefault();
1071
1071
  return;
1072
1072
  }
1073
+ if (this.type === 'int') {
1074
+ if (!/\d/.test(event.key)) {
1075
+ event.preventDefault();
1076
+ }
1077
+ return;
1078
+ }
1073
1079
  if (this.decimalPortion !== null) {
1074
1080
  const key = event.key;
1075
1081
  if (!/[\d.]/.test(key)) {
@@ -1132,6 +1138,14 @@ class Oslinput {
1132
1138
  this.modelChange.emit(this.model);
1133
1139
  return;
1134
1140
  }
1141
+ if (this.type === 'int') {
1142
+ const dotIndex = value.indexOf('.');
1143
+ const truncated = dotIndex !== -1 ? value.substring(0, dotIndex) : value;
1144
+ const digits = truncated.replace(/[^\d]/g, '');
1145
+ this.model = digits === '' ? null : parseInt(digits, 10);
1146
+ this.modelChange.emit(this.model);
1147
+ return;
1148
+ }
1135
1149
  if (this.isCapitalize) {
1136
1150
  value = typeof value == 'string' ? value?.toUpperCase() : value;
1137
1151
  }
@@ -1665,9 +1679,10 @@ class OslAutocomplete extends baseComponent {
1665
1679
  syncInputFromModel() {
1666
1680
  if (this.model !== null && this.model !== undefined) {
1667
1681
  const found = this.datasource.find((item) => this.getValue(item) === this.model);
1668
- if (found)
1682
+ if (found) {
1669
1683
  this.inputValue = this.getDisplay(found);
1670
- this.inputControl.setValue(this.getDisplay(found));
1684
+ this.inputControl.setValue(this.getDisplay(found));
1685
+ }
1671
1686
  }
1672
1687
  else {
1673
1688
  this.inputValue = '';