Skip to content

Commit

Permalink
feat: validation on valid inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
astagi committed Feb 29, 2024
1 parent 63868fc commit c662303
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
3 changes: 3 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
"plugin:prettier/recommended"
],
"rules": {
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-var-requires": "off",
"no-control-regex": "off",
"@angular-eslint/component-selector": [
"error",
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { inputToBoolean } from '../utils/coercion';

@Component({ template: '' })
export abstract class ItAbstractFormComponent<T = any> extends ItAbstractComponent implements OnInit, ControlValueAccessor, DoCheck {

/**
* The label of form control
*/
Expand All @@ -21,7 +20,7 @@ export abstract class ItAbstractFormComponent<T = any> extends ItAbstractCompone
* - <b>only-invalid</b>: Show only invalid validation color
* @default <b>only-invalid</b>: Show only invalid validation color
*/
@Input() validationMode: boolean | 'only-valid' | 'only-invalid' = 'only-invalid';
@Input() validationMode: boolean | 'only-valid' | 'only-invalid' = true;

/**
* Set the disabled state
Expand Down Expand Up @@ -89,11 +88,10 @@ export abstract class ItAbstractFormComponent<T = any> extends ItAbstractCompone
}
}

onChange = (_: T) => {
};
// eslint-disable-next-line @typescript-eslint/no-unused-vars
onChange = (_: T) => {};

onTouched = () => {
};
onTouched = () => {};

registerOnChange(fn: any): void {
this.control.valueChanges.subscribe(fn);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
[class.form-control]="readonly !== 'plaintext'"
[class.form-control-plaintext]="readonly === 'plaintext'"
[class.is-invalid]="isInvalid"
[class.is-valid]="isValid"
[class.just-validate-success-field]="isValid"
[formControl]="control"
[placeholder]="placeholder"
[readonly]="isReadonly"
Expand All @@ -57,7 +57,7 @@
[class.form-control]="readonly !== 'plaintext'"
[class.form-control-plaintext]="readonly === 'plaintext'"
[class.is-invalid]="isInvalid"
[class.is-valid]="isValid"
[class.just-validate-success-field]="isValid"
[formControl]="control"
[placeholder]="placeholder"
[readonly]="isReadonly"
Expand Down

0 comments on commit c662303

Please sign in to comment.