Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | 1x 5x 12x 1x 11x 4x 1x 8x 2x 6x 6x 4x 4x 2x 1x 1x 6x 1x 51x | /**
* Copyright (c) Siemens 2016 - 2025
* SPDX-License-Identifier: MIT
*/
import { Pipe, PipeTransform } from '@angular/core';
/** */
export const getFieldValue = (model: any, path: string[]): any => {
for (const p of path) {
if (!model) {
return model;
}
model = model[p];
}
return model;
};
// Got this from @ngx-formly/core/lib/utils
export const getKeyPath = (key?: any): string[] => {
if (!key) {
return [];
}
let path: string[] = [];
if (typeof key === 'string') {
const k = !key.includes('[') ? key : key.replace(/\[(\w+)\]/g, '.$1');
path = k.includes('.') ? k.split('.') : [k];
} else if (Array.isArray(key)) {
path = key.slice(0);
} else {
path = [`${key}`];
}
return path.slice(0);
};
@Pipe({ name: 'siValidationErrorId' })
export class SiValidationErrorIdPipe implements PipeTransform {
transform(value: string, ...args: any[]): string {
return `${value}-formly-validation-error`;
}
}
|