Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/v11.x-beta' into master-SUP-14476
Browse files Browse the repository at this point in the history
  • Loading branch information
netwarex committed Dec 1, 2022
2 parents cb330e7 + 255e078 commit e261d91
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
### Features

* Added official support for Angular 13
## 11.0.0-beta.2 (2022-12-01)

### Fixes

* Hide close UI element on toast when dismissOnClick is disabled (SUP-14476)
* Fixed min/max value behavior on number input (SUP-12404)

## 7.10.3 (2021-02-04)

Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,14 @@
"@types/node": "^16.11.33",
"@types/sortablejs": "~1.10.6",
"@types/webpack-env": "~1.15.3",
"@types/gulp-sass": "^5.0.0",
"codelyzer": "^6.0.0",
"gulp": "^4.0.0",
"gulp-filter": "~6.0.0",
"gulp-rename": "^2.0.0",
"gulp-sass": "^5.1.0",
"gulp-util": "~3.0.8",
"gulp-sass": "^5.1.0",
"highlight.js": "~10.2.0",
"jasmine-core": "^3.6.0",
"jasmine-spec-reporter": "^6.0.0",
Expand All @@ -127,7 +129,7 @@
"node-sass-tilde-importer": "^1.0.2",
"npm": "^6.14.10",
"protractor": "^7.0.0",
"puppeteer": "latest",
"puppeteer": "5.5.0",
"raw-loader": "^1.0.0",
"sass": "^1.51.0",
"ts-node": "9.1.1",
Expand Down
24 changes: 24 additions & 0 deletions src/components/input/input.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
ElementRef,
EventEmitter,
forwardRef,
HostListener,
Input,
OnChanges,
OnInit,
Expand Down Expand Up @@ -218,6 +219,18 @@ export class InputField implements AfterViewInit, ControlValueAccessor, OnInit,
}
}

@HostListener('keydown', ['$event'])
public onKeyDown(event) {
if (this.type === 'number') {
const keyboardEvent = event as KeyboardEvent;
if ((keyboardEvent.key === '-' && event.target.value) || keyboardEvent.key === '+') {
keyboardEvent.preventDefault();
} else if (keyboardEvent.key === '-' && !event.target.value) {
event.target.value = '-';
}
}
}

onBlur(e: Event): void {
e.stopPropagation();
const target = e.target as HTMLInputElement;
Expand All @@ -232,6 +245,7 @@ export class InputField implements AfterViewInit, ControlValueAccessor, OnInit,

onInput(e: Event): void {
const target = e.target as HTMLInputElement;
this.updateValue(target);
const value = this.currentValue = this.normalizeValue(target.value);
this.onChange(value);
this.change.emit(value);
Expand Down Expand Up @@ -265,4 +279,14 @@ export class InputField implements AfterViewInit, ControlValueAccessor, OnInit,
return val == null ? '' : String(val);
}
}

private updateValue(target: HTMLInputElement): void {
if (this.type === 'number') {
if (this.max && Number(target.value) > this.max) {
target.value = String(this.max);
} else if (this.min && Number(target.value) < this.min) {
target.value = String(this.min);
}
}
}
}
3 changes: 2 additions & 1 deletion src/components/notification/toast.tpl.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
[ngClass]="type"
(click)="dismiss()"
>
<span class="gtx-toast-btn_close">
<span class="gtx-toast-btn_close"
[hidden]="!dismissOnClick">
<icon>close</icon>
</span>
<span class="action" *ngIf="actionLabel">
Expand Down

0 comments on commit e261d91

Please sign in to comment.