@eui/components 19.1.2-snapshot-1743171142266 → 19.1.2-snapshot-1743492977329

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.
@@ -1418,18 +1418,29 @@ class EuiTableHighlightFilterPipe {
1418
1418
  * @returns
1419
1419
  */
1420
1420
  transform(value, strFilter, className = 'eui-table--highlighted') {
1421
- if (value) {
1422
- if (strFilter && strFilter.length > 0) {
1423
- const regex = new RegExp('(' + strFilter + ')', 'gi');
1424
- return value.toString().replace(regex, '<span class="' + className + '">$1</span>');
1425
- }
1426
- else {
1427
- return value;
1428
- }
1429
- }
1430
- else {
1421
+ if (!value)
1431
1422
  return '';
1432
- }
1423
+ if (!strFilter || strFilter.length === 0)
1424
+ return value;
1425
+ const generateVariants = (str) => {
1426
+ const variants = new Set([str]);
1427
+ for (let j = 1; j <= 3; j++) {
1428
+ for (const separator of ['.', ',', ' ']) {
1429
+ let newVariant = str;
1430
+ let i = j;
1431
+ while (i < newVariant.length) {
1432
+ newVariant = newVariant.slice(0, i) + separator + newVariant.slice(i);
1433
+ i += 4;
1434
+ }
1435
+ variants.add(newVariant);
1436
+ }
1437
+ }
1438
+ return Array.from(variants);
1439
+ };
1440
+ const isNumber = (str) => !isNaN(Number(str)) && str.trim() !== '';
1441
+ const variants = isNumber(strFilter) ? generateVariants(strFilter) : [strFilter];
1442
+ const regex = new RegExp(`(${variants.map(v => v.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')).join('|')})`, 'gi');
1443
+ return value.toString().replace(regex, `<span class="${className}">$1</span>`);
1433
1444
  }
1434
1445
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: EuiTableHighlightFilterPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
1435
1446
  static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.1", ngImport: i0, type: EuiTableHighlightFilterPipe, isStandalone: false, name: "euiTableHighlightFilter" }); }