imports/vx/client/code/ux.js
/**
     * Mount a React modal by rendering it into a pre-defined anchor element.
     *
     * @param {object} element React component definition.
     * @param {object} anchorSelector Anchor jQuery selector.
     * @return {object} React component instantiated.
     */
Mount a React modal by rendering it into a pre-defined anchor element.
@param {object} element React component definition.
@param {object} anchorSelector Anchor jQuery selector.
@return {object} React component instantiated.
Mount a React modal by rendering it into a pre - defined anchor element . @param { object } element React component definition . @param { object } anchorSelector Anchor jQuery selector . @return { object } React component instantiated .
mountModal(element, anchorSelector) {
        anchorSelector = anchorSelector || "#vx-anchor"
        const anchorId = anchorSelector.substr(1)
        const modalCount = $(anchorSelector).children().length + 1
        const modalContainerId = `${anchorId}-${modalCount}`
        const id = `${element.props.id}-${modalCount}`
        $(anchorSelector).append(`<div id="${modalContainerId}"></div>`)
        const clonedElement = React.cloneElement(element, { id, anchorSelector })
        OLog.warn(`ux.js mountModal id=${clonedElement.props.id} anchorSelector=${anchorSelector}`)
        return ReactDOM.render(clonedElement, $(`#${modalContainerId}`)[0])
    }
mountModal ( element , anchorSelector ) { anchorSelector = anchorSelector || "#vx-anchor" const anchorId = anchorSelector . substr ( 1 ) const modalCount = $ ( anchorSelector ) . children ( ) . length + 1 const modalContainerId = ` ${ anchorId } ${ modalCount } ` const id = ` ${ element . props . id } ${ modalCount } ` $ ( anchorSelector ) . append ( ` ${ modalContainerId } ` ) const clonedElement = React . cloneElement ( element , { id , anchorSelector } ) OLog . warn ( ` ${ clonedElement . props . id } ${ anchorSelector } ` ) return ReactDOM . render ( clonedElement , $ ( ` ${ modalContainerId } ` ) [ 0 ] ) }
Mount a React modal by rendering it into a pre-defined anchor element.
Mount a React modal by rendering it into a pre - defined anchor element .