All Downloads are FREE. Search and download functionalities are using the official Maven repository.

components.widgets.Html.Html.jsx Maven / Gradle / Ivy

The newest version!
import React from 'react'
import PropTypes from 'prop-types'

import { Html as HtmlSnippet } from '../../snippets/Html/Html'
import { parseExpression } from '../../../utils/evalExpression'
import { useHtmlResolver } from '../../../utils/useHtmlResolver'

/**
 * Компонент встаквки html-кода производит резолв плейсхолдеров
 * @reactProps {string} url - url html, который будет вставляться
 * @reactProps {string} id - id виджета
 * @reactProps {string} html - html строка
 * @reactProps {object} data - данные
 * 
 */

export const Html = ({
    html,
    data,
    id,
    className,
    loading = false,
}) => {
    const resolvedHtml = useHtmlResolver(html, data)

    if (!resolvedHtml) {
        return null
    }

    /* устраняет мерцания с плейсхолдерами */
    if (parseExpression(resolvedHtml)) {
        return null
    }

    return (
        !loading && (
            
        )
    )
}

export default Html




© 2015 - 2024 Weber Informatics LLC | Privacy Policy