Skip to content

Commit e218745

Browse files
RajeshwriKGLOBAL\u637272jharajeev55
authored
Task/list input box (#17)
Input box for steps and points in list popup disappeared when '0' was entered The changes are made in app-input-numeric component to handle the 0 case --------- Co-authored-by: GLOBAL\u637272 <rajeshwari.kiwad@tektronix.com> Co-authored-by: jharajeev55 <jharajeev55@gmail.com>
1 parent 074496a commit e218745

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

script-gen-ui/src/app/components/controls/input-numeric/input-numeric.component.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ export class InputNumericComponent implements ControlValueAccessor, OnInit {
5757
}
5858

5959
writeValue(value: number): void {
60-
if (value !== undefined) {
60+
// Accept all valid numbers including 0
61+
if (value !== undefined && value !== null && !isNaN(value)) {
6162
this._value = value;
6263
}
6364
}
@@ -77,11 +78,14 @@ export class InputNumericComponent implements ControlValueAccessor, OnInit {
7778
onInputChange(event: Event): void {
7879
const inputElement = event.target as HTMLInputElement;
7980

80-
if (this.displayValue !== inputElement.valueAsNumber) {
81+
const currentValue = this.displayValue;
82+
const newValue = inputElement.valueAsNumber;
83+
84+
if (currentValue !== newValue) {
8185
// Store previous value for fallback
8286
const previousValue = this.displayValue;
8387

84-
let value = inputElement.valueAsNumber;
88+
let value = newValue;
8589

8690
// Only update if the value is valid (not NaN)
8791
if (!isNaN(value)) {

script-gen-ui/src/app/components/main-sweep/list/list.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ <h3 style="margin: 0">List</h3>
1010
[label]="'Points/Steps'"
1111
[(ngModel)]="noOfPointsOrSteps"
1212
name="noOfPointsOrSteps"
13-
*ngIf="noOfPointsOrSteps"
13+
*ngIf="noOfPointsOrSteps !== undefined && noOfPointsOrSteps !== null"
1414
(keydown.enter)="emitStepsOrPoints()"
1515
[disabled]="!isNoOfPointsOrSteps"
1616
></app-input-numeric>

0 commit comments

Comments
 (0)