From 80fcd0c125d99c374d11843d6347050797f4a4ca Mon Sep 17 00:00:00 2001 From: Nikita Guryev Date: Thu, 9 Jul 2026 15:55:05 +0300 Subject: [PATCH] docs: filter non-digit in Series/Number fields (#DS-4058) --- ...ion-message-global-with-links-example.html | 30 +++++++++++++++++-- ...ation-message-global-with-links-example.ts | 20 ++++++++++++- 2 files changed, 47 insertions(+), 3 deletions(-) diff --git a/packages/docs-examples/components/validation/validation-message-global-with-links/validation-message-global-with-links-example.html b/packages/docs-examples/components/validation/validation-message-global-with-links/validation-message-global-with-links-example.html index b50b489f60..c3774dd433 100644 --- a/packages/docs-examples/components/validation/validation-message-global-with-links/validation-message-global-with-links-example.html +++ b/packages/docs-examples/components/validation/validation-message-global-with-links/validation-message-global-with-links-example.html @@ -26,14 +26,40 @@
Series - +
Number - +
diff --git a/packages/docs-examples/components/validation/validation-message-global-with-links/validation-message-global-with-links-example.ts b/packages/docs-examples/components/validation/validation-message-global-with-links/validation-message-global-with-links-example.ts index b208c4dfbc..9c34ca8b26 100644 --- a/packages/docs-examples/components/validation/validation-message-global-with-links/validation-message-global-with-links-example.ts +++ b/packages/docs-examples/components/validation/validation-message-global-with-links/validation-message-global-with-links-example.ts @@ -2,10 +2,13 @@ import { ChangeDetectionStrategy, Component, signal } from '@angular/core'; import { FormControl, FormGroup, FormsModule, ReactiveFormsModule } from '@angular/forms'; import { KbqAlertModule } from '@koobiq/components/alert'; import { KbqButtonModule } from '@koobiq/components/button'; -import { KbqFormsModule } from '@koobiq/components/core'; +import { KbqFormsModule, PopUpPlacements } from '@koobiq/components/core'; import { KbqIconModule } from '@koobiq/components/icon'; import { KbqInputModule } from '@koobiq/components/input'; import { KbqLinkModule } from '@koobiq/components/link'; +import { KbqToolTipModule, KbqTooltipTrigger } from '@koobiq/components/tooltip'; + +const restSymbolsRegex = /[^0-9]+/g; /** * @title Validation message global with links @@ -20,6 +23,7 @@ import { KbqLinkModule } from '@koobiq/components/link'; KbqButtonModule, KbqFormsModule, KbqLinkModule, + KbqToolTipModule, FormsModule ], templateUrl: 'validation-message-global-with-links-example.html', @@ -43,6 +47,8 @@ import { KbqLinkModule } from '@koobiq/components/link'; } }) export class ValidationMessageGlobalWithLinksExample { + protected readonly popUpPlacements = PopUpPlacements; + protected readonly inProgress = signal(false); protected readonly showError = signal(false); protected readonly form = new FormGroup({ @@ -53,6 +59,18 @@ export class ValidationMessageGlobalWithLinksExample { patronymic: new FormControl('') }); + onInput(event: Event, tooltip: KbqTooltipTrigger, control: FormControl): void { + if (event.target instanceof HTMLInputElement && event.target.value && /\D/.test(event.target.value)) { + control.setValue(event.target.value.replace(restSymbolsRegex, '')); + + if (!tooltip.isOpen) { + tooltip.show(); + + setTimeout(() => tooltip.hide(), 3000); + } + } + } + submitForm() { this.inProgress.set(true);