UNPKG

@adaptabletools/adaptable

Version:

Powerful AG Grid extension which provides advanced, cutting-edge functionality to meet all DataGrid requirements

46 lines (45 loc) 1.59 kB
import { jsx as _jsx } from "react/jsx-runtime"; import * as React from 'react'; import { renderWithAdaptableContext } from '../View/renderWithAdaptableContext'; export const createAgStatusPanelComponent = (component, adaptable, context) => { if (adaptable.variant === 'react') { return (props) => { const children = renderWithAdaptableContext(React.createElement(component, { params: props, adaptableApi: adaptable.api, context, }), adaptable); return (_jsx("div", { className: "ab-StatusBar", ref: (node) => { if (node) { node.parentElement.style.display = 'flex'; } }, children: children })); }; } return class StatusBarRenderer { params; eGui; unmountReactRoot; init(params) { this.params = params; this.eGui = document.createElement('div'); this.eGui.classList.add('ab-StatusBar'); this.render(); } render() { const props = { params: this.params, adaptableApi: adaptable.api, context, }; const children = renderWithAdaptableContext(React.createElement(component, props), adaptable); this.unmountReactRoot = adaptable.renderReactRoot(children, this.eGui); } getGui() { return this.eGui; } destroy() { this.unmountReactRoot?.(); } }; };