UNPKG

@adaptabletools/adaptable-cjs

Version:

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

40 lines (39 loc) 2.58 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.PanelWithImage = void 0; const tslib_1 = require("tslib"); const React = tslib_1.__importStar(require("react")); const Panel_1 = tslib_1.__importDefault(require("../../../components/Panel")); const icons_1 = require("../../../components/icons"); const ButtonInfo_1 = require("../Buttons/ButtonInfo"); const twMerge_1 = require("../../../twMerge"); const Flex_1 = require("../../../components/Flex"); //We cannot destructure this.props using the react way in typescript which is a real pain as you //need to transfer props individually as a consequence //let { buttonContent, ...other } = this.props class PanelWithImageCmp extends React.Component { render() { const IconCmp = icons_1.allIcons[(this.props.icon || this.props.glyphicon)]; const headerStyle = {}; if (this.props.headerColor) { headerStyle.color = this.props.headerColor; headerStyle.fill = this.props.headerColor; } let headerRow = (React.createElement(Flex_1.Flex, { className: "twa:flex-1" }, React.createElement(Flex_1.Flex, { alignItems: "center" }, React.createElement(Flex_1.Flex, { className: "twa:min-h-[15px]", alignItems: "center", style: headerStyle }, IconCmp ? React.createElement(IconCmp, null) : null, React.createElement(Flex_1.Box, { className: "twa:mr-2" }), this.props.header ?? '', React.createElement(Flex_1.Box, { className: "twa:mr-2", "data-name": "space-after" }), this.props.infoLink != null && !this.props.infoLinkDisabled && (React.createElement(ButtonInfo_1.ButtonInfo, { onClick: () => window.open(this.props.infoLink, '_blank' // <- opens the link in a new tab or window. ) }))), React.createElement(Flex_1.Flex, { className: "twa:flex-1" }), this.props.button && React.cloneElement(this.props.button)))); return (React.createElement(Panel_1.default, { header: headerRow, variant: this.props.variant, style: this.props.style, bodyScroll: this.props.bodyScroll !== undefined ? this.props.bodyScroll : true, className: (0, twMerge_1.twMerge)('twa:rounded-none twa:border-none', this.props.className), bodyProps: { ...this.props.bodyProps, className: (0, twMerge_1.twMerge)('twa:p-0', this.props.bodyProps?.className), } }, this.props.children)); } } exports.PanelWithImage = PanelWithImageCmp;