How to use @microsoft/fast-data-utilities-react - 10 common examples

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
"",
                        reactChildrenStringSchema,
                        data
                    )
                );
            }
        } else {
            const isRoot: boolean = isRootLocation(lastComponentDataLocation);
            const rootLocationOfComponent: string = isRoot
                ? ""
                : lastComponentDataLocation.replace(dataLocationItem, "");
            const dataLocationFromLastComponent: string = getCurrentComponentDataLocation(
                dataLocationItem,
                lastComponentDataLocation
            );
            let currentSchemaLocation: string = mapSchemaLocationFromDataLocation(
                isRoot ? dataLocationItem : dataLocationFromLastComponent,
                isRoot ? data : get(data, rootLocationOfComponent),
                currentComponentSchema
            );
            const currentSchemaLocationSegments: string[] = currentSchemaLocation.split(
                "."
            );
            const currentSchemaLocationSegmentsLength: number =
                currentSchemaLocationSegments.length;
            if (
                !isNaN(
                    parseInt(
                        currentSchemaLocationSegments[
                            currentSchemaLocationSegmentsLength - 1
                        ],
                        10
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-form-generator-react / src / form / form.utilities.ts View on Github external
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 = "";

    dataLocations.forEach((dataLocationItem: string) => {
        if (dataLocationsOfChildren.includes(dataLocationItem)) {
            const isChildString: boolean =
                typeof get(data, dataLocationItem) === "string";
            currentComponentSchema = getSchemaByDataLocation(
                schema,
                data,
                dataLocationItem,
github microsoft / fast-dna / packages / fast-form-generator-react / src / form / form.utilities.ts View on Github external
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 = "";

    dataLocations.forEach((dataLocationItem: string) => {
        if (dataLocationsOfChildren.includes(dataLocationItem)) {
            const isChildString: boolean =
                typeof get(data, dataLocationItem) === "string";
            currentComponentSchema = getSchemaByDataLocation(
                schema,
                data,
                dataLocationItem,
                allChildOptions
github microsoft / fast-dna / packages / fast-form-generator-react / src / form / form-item.children.tsx View on Github external
private generateChildOptionText(item: any): string {
        const childOption: FormChildOptionItem = getChildOptionBySchemaId(
            item.id,
            this.childOptions
        );

        if (typeof childOption === "object" && childOption !== null) {
            return childOption.name;
        } else {
            return this.getChildOptionTextString(item);
        }
    }
github microsoft / fast-dna / packages / fast-form-generator-react / src / form / form.utilities.ts View on Github external
export function getComponentByDataLocation(
    id: string,
    childOptions: FormChildOptionItem[]
): any {
    const childOption: FormChildOptionItem = getChildOptionBySchemaId(id, childOptions);

    return childOption ? childOption.component : null;
}
github microsoft / fast-dna / packages / fast-form-generator-react / src / form / form.utilities.ts View on Github external
export function getNavigationItem(
    dataLocation: string,
    schemaLocation: string,
    schema: any,
    data: any
): NavigationItem {
    return {
        dataLocation,
        schemaLocation,
        title: schema.title || "Untitled",
        data: getPartialData(dataLocation, data),
        schema,
    };
}
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,
github microsoft / fast-dna / packages / fast-viewer-react / src / viewer-content / viewer-content.base.tsx View on Github external
(componentDataItem: ComponentData, index: number) => {
                const mappedComponent: any = this.props.components.find(
                    (component: ChildOptionItem) => {
                        return componentDataItem.id === component.schema.id;
                    }
                );

                return (
                    
                );
            }
        );