<commit_before>import { Component, createElement } from "react";

import { Carousel, Image } from "./components/Carousel";
import CarouselContainer, { CarouselContainerProps } from "./components/CarouselContainer";

type VisibilityMap = {
    [P in keyof CarouselContainerProps]: boolean;
};

// tslint:disable class-name
export class preview extends Component<CarouselContainerProps, {}> {
    render() {
        const validationAlert = CarouselContainer.validateProps(this.props);

        return createElement(Carousel, {
            alertMessage: validationAlert,
            images: this.getImages(this.props)
        });
    }

    private getImages(props: CarouselContainerProps): Image[] {
        const defaultImages = [ { url: require("./img/Preview.png"), openPageAs: props.openPageAs } ];
        if (props.dataSource === "static") {
            return props.staticImages && props.staticImages.length
                ? props.staticImages
                : defaultImages;
        }

        return defaultImages;
    }
}

export function getPreviewCss() {
    return require("./ui/Carousel.scss");
}

export function getVisibleProperties(props: CarouselContainerProps, visibilityMap: VisibilityMap) {
    visibilityMap.dataSourceMicroflow = props.dataSource === "microflow";
    visibilityMap.entityConstraint = props.dataSource === "XPath";
    visibilityMap.staticImages = props.dataSource === "static";
    visibilityMap.imagesEntity = props.dataSource === "microflow";

    visibilityMap.onClickForm = props.onClickOptions === "showPage";
    visibilityMap.openPageAs = props.onClickOptions === "showPage";
    visibilityMap.onClickMicroflow = props.onClickOptions === "callMicroflow";
    visibilityMap.onClickNanoflow = props.onClickOptions === "callNanoflow";

    return visibilityMap;
}
<commit_msg>Fix webmodeler static image visibility<commit_after>import { Component, createElement } from "react";

import { Carousel, Image } from "./components/Carousel";
import CarouselContainer, { CarouselContainerProps } from "./components/CarouselContainer";

type VisibilityMap = {
    [P in keyof CarouselContainerProps]: boolean;
};

// tslint:disable class-name
declare function require(name: string): string;
export class preview extends Component<CarouselContainerProps, {}> {
    render() {
        const validationAlert = CarouselContainer.validateProps(this.props);

        return createElement(Carousel, {
            alertMessage: validationAlert,
            images: this.getImages(this.props)
        });
    }

    private getImages(props: CarouselContainerProps): Image[] {
        const defaultImages = [ { url: require("./img/Preview.png"), openPageAs: props.openPageAs } ];
        if (props.dataSource === "static") {
            return props.staticImages && props.staticImages.length
                ? props.staticImages
                : defaultImages;
        }

        return defaultImages;
    }
}

export function getPreviewCss() {
    return require("./ui/Carousel.scss");
}

export function getVisibleProperties(props: CarouselContainerProps, visibilityMap: VisibilityMap) {
    visibilityMap.dataSourceMicroflow = props.dataSource === "microflow";
    visibilityMap.entityConstraint = props.dataSource === "XPath";
    visibilityMap.staticImages = props.dataSource === "static" ? visibilityMap.staticImages : false;
    visibilityMap.imagesEntity = props.dataSource === "microflow";

    visibilityMap.onClickForm = props.onClickOptions === "showPage";
    visibilityMap.openPageAs = props.onClickOptions === "showPage";
    visibilityMap.onClickMicroflow = props.onClickOptions === "callMicroflow";
    visibilityMap.onClickNanoflow = props.onClickOptions === "callNanoflow";

    return visibilityMap;
}

{'fraction_non_alphanumeric': 0.11312700106723586, 'fraction_numerical': 0.0, 'mean_word_length': 3.787994891443167, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4862225', 'n_tokens_mistral': 1002, 'n_tokens_neox': 972, 'n_words': 203}