Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
3212052
Added changes from previous pull request
1307-Dev May 5, 2026
26678fa
Added cahnges adhering to comments.
1307-Dev May 5, 2026
abe7f27
recommended changes
1307-Dev May 6, 2026
a7cf670
Programatically changing values should update the field if touched isโ€ฆ
1307-Dev May 20, 2026
d5267d8
Merge branch 'main' into feat/2595-input-numberinput-textarea-validation
1307-Dev Jun 30, 2026
cde24ec
Added a fix for vmodel not working both ways as expected in vue examples
1307-Dev Jun 30, 2026
5188353
Merge branch 'main' into feat/2595-input-numberinput-textarea-validation
1307-Dev Jul 29, 2026
b566b6f
Added merge conflict fix
1307-Dev Aug 19, 2026
e165020
Merge branch 'main' into feat/2595-input-numberinput-textarea-validation
JonaMaiss Oct 21, 2026
5acf3f5
enhance input validations behavior
JonaMaiss Oct 22, 2026
f013433
enhance date-input validation
JonaMaiss Oct 22, 2026
3a22912
Merge branch 'main' into feat/2595-input-numberinput-textarea-validation
JonaMaiss Oct 22, 2026
42e34e0
change availability of variables from 5.3.0. to 6.0.0
JonaMaiss Oct 27, 2026
0e353fd
clear button should remove touched state of input field
JonaMaiss Oct 27, 2026
95f7226
Merge branch 'main' into feat/2595-input-numberinput-textarea-validation
JonaMaiss Oct 27, 2026
42e123a
automatically changed files
JonaMaiss Oct 27, 2026
f6ff785
clear valdation state
JonaMaiss Oct 27, 2026
c412f69
fix lint error
JonaMaiss Oct 27, 2026
2e29166
Merge branch 'main' into feat/2595-input-numberinput-textarea-validation
JonaMaiss Oct 30, 2026
e8b5cc6
fix implementation after merging main
JonaMaiss Oct 30, 2026
87d45a5
Merge branch 'main' into feat/2595-input-numberinput-textarea-validation
JonaMaiss Nov 9, 2026
6434516
remove @internal from getValidityState
JonaMaiss Nov 9, 2026
0ca1715
Merge branch 'main' into feat/2595-input-numberinput-textarea-validation
JonaMaiss Nov 10, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/angular-input-validation-clear.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@siemens/ix-angular': minor
---

Expose `clear()` on input, number-input, textarea, and date-input, and `getValidityState()` on number-input and textarea in both NgModule and standalone components.
Comment thread
lzeiml marked this conversation as resolved.
Resolved

Calling `clear()` also marks the bound Angular form control as untouched. Required validation feedback stays hidden until the field is touched again, without removing validators or resetting dirty state.
13 changes: 13 additions & 0 deletions .changeset/input-validation-clear.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
'@siemens/ix': minor
---

Add `clear()` to input, number-input, textarea, and date-input to empty their values and reset touched validation feedback. Number-input clearing respects `allowEmptyValueChange`.

Keep touched validation feedback synchronized with Angular forms, including when clearing an already-empty field.

Add `getValidityState()` to number-input and textarea for consistent access to native validation.

Keep programmatic values, form values, and validation feedback synchronized while preserving decimal entry in number-input and removing stale error-message references after clearing.

Fixes #1799.
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,13 @@ export class ValueAccessor
}
}

@HostListener('ixClear', ['$event.target'])
_handleClearEvent(el: HTMLElement): void {
if (el === this.elementRef.nativeElement) {
this.getAssignedNgControl()?.control?.markAsUntouched();
}
}

@HostListener('ixBlur', ['$event.target'])
_handleBlurEvent(el: any): void {
if (el === this.elementRef.nativeElement) {
Expand Down
8 changes: 4 additions & 4 deletions packages/angular/src/components.ts
Original file line number Diff line number Diff line change
Expand Up @@ -833,7 +833,7 @@ It is not emitted for programmatic prop input changes. @since 6.0.0

@ProxyCmp({
inputs: ['ariaLabelCalendarButton', 'ariaLabelNextMonthButton', 'ariaLabelPreviousMonthButton', 'disabled', 'displayFormat', 'enableTopLayer', 'format', 'helperText', 'i18nCancel', 'i18nConfirm', 'i18nErrorDateUnparsable', 'infoText', 'invalidText', 'label', 'locale', 'maxDate', 'minDate', 'name', 'placeholder', 'readonly', 'requireConfirmation', 'required', 'showTextAsTooltip', 'showWeekNumbers', 'suppressSubmitOnEnter', 'textAlignment', 'validText', 'value', 'warningText', 'weekStartIndex'],
methods: ['getNativeInputElement', 'focusInput']
methods: ['getNativeInputElement', 'focusInput', 'clear']
})
@Component({
selector: 'ix-date-input',
Expand Down Expand Up @@ -1657,7 +1657,7 @@ export declare interface IxInfoPage extends Components.IxInfoPage {}

@ProxyCmp({
inputs: ['allowedCharactersPattern', 'disabled', 'helperText', 'infoText', 'invalidText', 'label', 'maxLength', 'minLength', 'name', 'pattern', 'placeholder', 'readonly', 'required', 'showTextAsTooltip', 'suppressSubmitOnEnter', 'textAlignment', 'type', 'validText', 'value', 'warningText'],
methods: ['getNativeInputElement', 'getValidityState', 'focusInput']
methods: ['getNativeInputElement', 'getValidityState', 'focusInput', 'clear']
})
@Component({
selector: 'ix-input',
Expand Down Expand Up @@ -2419,7 +2419,7 @@ Can be prevented, in which case only the event is triggered, and the modal remai

@ProxyCmp({
inputs: ['allowEmptyValueChange', 'allowedCharactersPattern', 'disabled', 'helperText', 'infoText', 'invalidText', 'label', 'max', 'min', 'name', 'pattern', 'placeholder', 'readonly', 'required', 'showStepperButtons', 'showTextAsTooltip', 'step', 'suppressSubmitOnEnter', 'textAlignment', 'validText', 'value', 'warningText'],
methods: ['getNativeInputElement', 'focusInput']
methods: ['getNativeInputElement', 'focusInput', 'clear', 'getValidityState']
})
@Component({
selector: 'ix-number-input',
Expand Down Expand Up @@ -3142,7 +3142,7 @@ export declare interface IxTabs extends Components.IxTabs {

@ProxyCmp({
inputs: ['disabled', 'helperText', 'infoText', 'invalidText', 'label', 'maxLength', 'minLength', 'name', 'placeholder', 'readonly', 'required', 'resizeBehavior', 'showTextAsTooltip', 'textareaCols', 'textareaHeight', 'textareaRows', 'textareaWidth', 'validText', 'value', 'warningText'],
methods: ['getNativeInputElement', 'focusInput']
methods: ['getNativeInputElement', 'getValidityState', 'focusInput', 'clear']
})
@Component({
selector: 'ix-textarea',
Expand Down
8 changes: 4 additions & 4 deletions packages/angular/standalone/src/components.ts
Original file line number Diff line number Diff line change
Expand Up @@ -948,7 +948,7 @@ It is not emitted for programmatic prop input changes. @since 6.0.0
@ProxyCmp({
defineCustomElementFn: defineIxDateInput,
inputs: ['ariaLabelCalendarButton', 'ariaLabelNextMonthButton', 'ariaLabelPreviousMonthButton', 'disabled', 'displayFormat', 'enableTopLayer', 'format', 'helperText', 'i18nCancel', 'i18nConfirm', 'i18nErrorDateUnparsable', 'infoText', 'invalidText', 'label', 'locale', 'maxDate', 'minDate', 'name', 'placeholder', 'readonly', 'requireConfirmation', 'required', 'showTextAsTooltip', 'showWeekNumbers', 'suppressSubmitOnEnter', 'textAlignment', 'validText', 'value', 'warningText', 'weekStartIndex'],
methods: ['getNativeInputElement', 'focusInput']
methods: ['getNativeInputElement', 'focusInput', 'clear']
})
@Component({
selector: 'ix-date-input',
Expand Down Expand Up @@ -1772,7 +1772,7 @@ export declare interface IxInfoPage extends Components.IxInfoPage {}
@ProxyCmp({
defineCustomElementFn: defineIxInput,
inputs: ['allowedCharactersPattern', 'disabled', 'helperText', 'infoText', 'invalidText', 'label', 'maxLength', 'minLength', 'name', 'pattern', 'placeholder', 'readonly', 'required', 'showTextAsTooltip', 'suppressSubmitOnEnter', 'textAlignment', 'type', 'validText', 'value', 'warningText'],
methods: ['getNativeInputElement', 'getValidityState', 'focusInput']
methods: ['getNativeInputElement', 'getValidityState', 'focusInput', 'clear']
})
@Component({
selector: 'ix-input',
Expand Down Expand Up @@ -2534,7 +2534,7 @@ Can be prevented, in which case only the event is triggered, and the modal remai
@ProxyCmp({
defineCustomElementFn: defineIxNumberInput,
inputs: ['allowEmptyValueChange', 'allowedCharactersPattern', 'disabled', 'helperText', 'infoText', 'invalidText', 'label', 'max', 'min', 'name', 'pattern', 'placeholder', 'readonly', 'required', 'showStepperButtons', 'showTextAsTooltip', 'step', 'suppressSubmitOnEnter', 'textAlignment', 'validText', 'value', 'warningText'],
methods: ['getNativeInputElement', 'focusInput']
methods: ['getNativeInputElement', 'focusInput', 'clear', 'getValidityState']
})
@Component({
selector: 'ix-number-input',
Expand Down Expand Up @@ -3257,7 +3257,7 @@ export declare interface IxTabs extends Components.IxTabs {
@ProxyCmp({
defineCustomElementFn: defineIxTextarea,
inputs: ['disabled', 'helperText', 'infoText', 'invalidText', 'label', 'maxLength', 'minLength', 'name', 'placeholder', 'readonly', 'required', 'resizeBehavior', 'showTextAsTooltip', 'textareaCols', 'textareaHeight', 'textareaRows', 'textareaWidth', 'validText', 'value', 'warningText'],
methods: ['getNativeInputElement', 'focusInput']
methods: ['getNativeInputElement', 'getValidityState', 'focusInput', 'clear']
})
@Component({
selector: 'ix-textarea',
Expand Down
30 changes: 30 additions & 0 deletions packages/core/component-api.json
Original file line number Diff line number Diff line change
Expand Up @@ -3076,6 +3076,11 @@
}
],
"methods": [
{
"name": "clear",
"signature": "clear() => Promise<void>",
"deprecated": false
},
{
"name": "focusInput",
"signature": "focusInput() => Promise<void>",
Expand Down Expand Up @@ -5963,6 +5968,11 @@
}
],
"methods": [
{
"name": "clear",
"signature": "clear() => Promise<void>",
"deprecated": false
},
{
"name": "focusInput",
"signature": "focusInput() => Promise<void>",
Expand Down Expand Up @@ -8136,6 +8146,11 @@
}
],
"methods": [
{
"name": "clear",
"signature": "clear() => Promise<void>",
"deprecated": false
},
{
"name": "focusInput",
"signature": "focusInput() => Promise<void>",
Expand All @@ -8145,6 +8160,11 @@
"name": "getNativeInputElement",
"signature": "getNativeInputElement() => Promise<HTMLInputElement>",
"deprecated": false
},
{
"name": "getValidityState",
"signature": "getValidityState() => Promise<ValidityState>",
"deprecated": false
}
],
"events": [
Expand Down Expand Up @@ -10680,6 +10700,11 @@
}
],
"methods": [
{
"name": "clear",
"signature": "clear() => Promise<void>",
"deprecated": false
},
{
"name": "focusInput",
"signature": "focusInput() => Promise<void>",
Expand All @@ -10689,6 +10714,11 @@
"name": "getNativeInputElement",
"signature": "getNativeInputElement() => Promise<HTMLTextAreaElement>",
"deprecated": false
},
{
"name": "getValidityState",
"signature": "getValidityState() => Promise<ValidityState>",
"deprecated": false
}
],
"events": [
Expand Down
26 changes: 26 additions & 0 deletions packages/core/src/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1443,6 +1443,11 @@ export namespace Components {
* @default 'Previous month'
*/
"ariaLabelPreviousMonthButton"?: string;
/**
* Clears the input field value and resets validation state. Sets the value to empty and removes touched state to suppress validation.
* @since 6.0.0
*/
"clear": () => Promise<void>;
/**
* Disabled attribute.
* @default false
Expand Down Expand Up @@ -2996,6 +3001,11 @@ export namespace Components {
* The allowed characters pattern for the text field.
*/
"allowedCharactersPattern"?: string;
/**
* Clears the input field value and resets validation state. Sets the value to empty and removes touched state to suppress validation.
* @since 6.0.0
*/
"clear": () => Promise<void>;
Comment thread
JonaMaiss marked this conversation as resolved.
Resolved
/**
* Specifies whether the text field is disabled.
* @default false
Expand Down Expand Up @@ -3980,6 +3990,11 @@ export namespace Components {
* The allowed characters pattern for the input field
*/
"allowedCharactersPattern"?: string;
/**
* Clears the input field value and resets validation state. Sets the value to empty and removes touched state to suppress validation. Emits 0 unless allowEmptyValueChange is enabled, in which case it emits undefined.
* @since 6.0.0
*/
"clear": () => Promise<void>;
/**
* Disables the input field
* @default false
Expand All @@ -3994,6 +4009,11 @@ export namespace Components {
* Returns the native input element used under the hood
*/
"getNativeInputElement": () => Promise<HTMLInputElement>;
/**
* Returns the validity state of the number input field.
* @since 6.0.0
*/
"getValidityState": () => Promise<ValidityState>;
"hasValidValue": () => Promise<boolean>;
/**
* The helper text for the input field
Expand Down Expand Up @@ -5162,6 +5182,11 @@ export namespace Components {
* @documentation https://ix.siemens.io//docs/components/textarea/guide.md
*/
interface IxTextarea {
/**
* Clears the input field value and resets validation state. Sets the value to empty and removes touched state to suppress validation.
* @since 6.0.0
*/
"clear": () => Promise<void>;
/**
* Determines if the textarea field is disabled.
* @default false
Expand All @@ -5177,6 +5202,7 @@ export namespace Components {
*/
"getNativeInputElement": () => Promise<HTMLTextAreaElement>;
/**
* Returns the validity state of the textarea field.
* @since 6.0.0
*/
"getValidityState": () => Promise<ValidityState>;
Expand Down
27 changes: 27 additions & 0 deletions packages/core/src/components/date-input/date-input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import {
handleSubmitOnEnterKeydown,
onInputBlurWithChange,
onInputFocus,
resetInputValidation,
} from '../input/input.util';
import {
ClassMutationObserver,
Expand Down Expand Up @@ -658,6 +659,32 @@ export class DateInput
return Promise.resolve(this.touched);
}

/**
* Clears the input field value and resets validation state.
* Sets the value to empty and removes touched state to suppress validation.
* @since 6.0.0
*/
@Method()
async clear(): Promise<void> {
const input = await this.getNativeInputElement();
await this.closeDropdown();
this.inputBlur.onFocus();
this.touched = false;
this.initialValue = '';
this.isInputInvalid = false;
this.invalidReason = undefined;
this.validityTracker = createPickerValidityStateTracker();
this.from = '';
resetInputValidation(this, input);
const wasEmpty = this.value === '';
this.updateFormInternalValue('');
// The value watcher emits for changed values; empty fields need an event too.
if (wasEmpty) {
this.valueChange.emit('');
}
await revalidate(this);
}

getPickerElement(): MakeRef<HTMLIxDropdownElement> | null {
return this.dropdownElementRef;
}
Expand Down
Loading
Loading