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

components.pages.DefaultPage.jsx Maven / Gradle / Ivy

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

import Alert from '../snippets/Alerts/Alert'
import { PageTitle, PageTitle as DocumentTitle } from '../core/PageTitle'
import { BreadcrumbContainer } from '../core/Breadcrumb/BreadcrumbContainer'
import Toolbar from '../buttons/Toolbar'

import { usePageRegister } from './usePageRegister'

/**
 * Стандартное наполнение страницы
 * @param metadata
 * @param toolbar
 * @param entityKey
 * @param error
 * @param children
 * @param disabled
 * @param dispatch
 * @return {*}
 * @constructor
 */
function DefaultPage({
    metadata = {},
    toolbar,
    entityKey,
    error,
    children,
    disabled,
    dispatch,
}) {
    const { style, className, datasources, id: pageId, page = {}, breadcrumb } = metadata
    const { title, htmlTitle, datasource, model: modelPrefix = 'resolve' } = page

    usePageRegister(datasources, dispatch, pageId)

    return (
        
{error && } {toolbar && (toolbar.topLeft || toolbar.topRight || toolbar.topCenter) && (
)} {children} { toolbar && (toolbar.bottomLeft || toolbar.bottomRight || toolbar.bottomCenter) && (
) }
) } DefaultPage.propTypes = { metadata: PropTypes.object, toolbar: PropTypes.object, entityKey: PropTypes.string, error: PropTypes.oneOfType([PropTypes.object, PropTypes.oneOf([false])]), children: PropTypes.oneOfType([ PropTypes.node, PropTypes.func, PropTypes.element, ]), disabled: PropTypes.bool, dispatch: PropTypes.func, } DefaultPage.defaultProps = { toolbar: {}, } export default DefaultPage




© 2015 - 2024 Weber Informatics LLC | Privacy Policy