@corp-products/ui-components 4.2.6 → 4.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -49,7 +49,7 @@ import * as i1$5 from 'primeng/toggleswitch';
49
49
  import { ToggleSwitchModule } from 'primeng/toggleswitch';
50
50
  import * as i1$6 from '@ng-bootstrap/ng-bootstrap';
51
51
  import { NgbDatepickerI18n, NgbCalendarIslamicUmalqura, NgbDatepickerModule, NgbCalendar, NgbCalendarGregorian, NgbDate } from '@ng-bootstrap/ng-bootstrap';
52
- import { trigger, state, style, transition, animate } from '@angular/animations';
52
+ import { trigger, state, transition, style, animate } from '@angular/animations';
53
53
  import '@angular/localize/init';
54
54
  import * as i2$4 from 'primeng/accordion';
55
55
  import { AccordionModule } from 'primeng/accordion';
@@ -837,6 +837,7 @@ function numbersOnlyValidator(control) {
837
837
  return isNumbersOnly ? null : { numbersOnly: true };
838
838
  }
839
839
 
840
+ const WHITESPACE_REGEX = /\s/;
840
841
  function maxRepeatedCharsValidator(maxRepeats = 3) {
841
842
  return (control) => {
842
843
  const value = control.value;
@@ -844,8 +845,12 @@ function maxRepeatedCharsValidator(maxRepeats = 3) {
844
845
  return null;
845
846
  const str = value.toString();
846
847
  let count = 1;
847
- for (let i = 1; i < str.length; i++) {
848
- if (str[i] === str[i - 1]) {
848
+ let prevChar = null;
849
+ for (const char of str) {
850
+ if (WHITESPACE_REGEX.test(char)) {
851
+ continue;
852
+ }
853
+ if (prevChar !== null && char === prevChar) {
849
854
  count++;
850
855
  if (count > maxRepeats) {
851
856
  return { maxRepeatedChars: { maxRepeats } };
@@ -854,6 +859,7 @@ function maxRepeatedCharsValidator(maxRepeats = 3) {
854
859
  else {
855
860
  count = 1;
856
861
  }
862
+ prevChar = char;
857
863
  }
858
864
  return null;
859
865
  };