components.widgets.Html.HtmlWidget.jsx Maven / Gradle / Ivy
The newest version!
import React from 'react'
import PropTypes from 'prop-types'
import { useSelector } from 'react-redux'
import StandardWidget from '../StandardWidget'
import { WidgetHOC } from '../../../core/widget/WidgetHOC'
import { widgetPropTypes } from '../../../core/widget/propTypes'
import { dataSourceModelByPrefixSelector } from '../../../ducks/datasource/selectors'
import { ModelPrefix } from '../../../core/datasource/const'
import { Html } from './Html'
/**
* HtmlWidget
* @reactProps {string} containerId - id конейтенера
* @reactProps {string} pageId - id страницы
* @reactProps {boolean} url - url для фетчинга
* @reactProps {string} widgetId - id виджета
* @reactProps {string} html - html код
* @reactProps {object} dataProvider
* @reactProps {object} datasource
*/
function Widget({
id,
toolbar,
className,
style,
url,
html,
loading,
datasource,
}) {
const datasourceModel = useSelector(dataSourceModelByPrefixSelector(datasource, ModelPrefix.source))?.[0]
return (
)
}
Widget.propTypes = {
...widgetPropTypes,
url: PropTypes.bool,
html: PropTypes.string,
}
/**
* @type ConnectedWidget
*/
export const HtmlWidget = WidgetHOC(Widget)