How to use the @microsoft/fast-data-utilities-react.getDataLocationsOfChildren function in @microsoft/fast-data-utilities-react

To help you get started, we’ve selected a few @microsoft/fast-data-utilities-react examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github microsoft / fast-dna / packages / fast-form-generator-react / src / form / form.utilities.ts View on Github external
export function getNavigation(
    dataLocation: string,
    data: any,
    schema: any,
    childOptions: FormChildOptionItem[]
): NavigationItem[] {
    const allChildOptions: FormChildOptionItem[] = getReactDefaultChildren().concat(
        childOptions
    );
    const dataLocationsOfChildren: string[] = getDataLocationsOfChildren(
        schema,
        data,
        allChildOptions
    );
    const normalizedDataLocation: string = !dataLocationsOfChildren.includes(dataLocation)
        ? normalizeDataLocation(dataLocation, data)
        : typeof get(data, dataLocation) === "string"
            ? normalizeDataLocation(dataLocation, data)
            : `${normalizeDataLocation(dataLocation, data)}.${propsKeyword}`;
    const dataLocations: Set = new Set(
        [""].concat(getLocationsFromSegments(normalizedDataLocation.split(".")))
    );
    const navigationItems: NavigationItem[] = [];
    let currentComponentSchema: any = schema;
    let lastComponentDataLocation: string = "";
github microsoft / fast-dna / packages / fast-navigation-generator-react / src / navigation / navigation.utilities.ts View on Github external
export function getNavigationFromData(
    data: any,
    schema: any,
    childOptions: ChildOptionItem[]
): TreeNavigation {
    const childrenDataLocations: string[] = getDataLocationsOfChildren(
        schema,
        data,
        childOptions
    );

    const navigation: TreeNavigation[] = getNavigationFromChildLocations(
        [],
        childrenDataLocations,
        data,
        childOptions
    );

    return {
        text: schema.title ? schema.title : "Undefined",
        dataLocation: "",
        items: navigation,