UNPKG

igniteui-react-core

Version:
110 lines (109 loc) 5.18 kB
/* THIS INFRAGISTICS ULTIMATE SOFTWARE LICENSE AGREEMENT ("AGREEMENT") LOCATED HERE: https://www.infragistics.com/legal/license/igultimate-la https://www.infragistics.com/legal/license/igultimate-eula GOVERNS THE LICENSING, INSTALLATION AND USE OF INFRAGISTICS SOFTWARE. BY DOWNLOADING AND/OR INSTALLING AND USING INFRAGISTICS SOFTWARE: you are indicating that you have read and understand this Agreement, and agree to be legally bound by it on behalf of the yourself and your company. */ import { __extends } from "tslib"; import * as React from 'react'; import { IgrTemplateContent } from './igr-template-content'; import { FontDefaults } from "./FontDefaults"; var requiredStyle = /*@__PURE__*/ /*@__PURE__*/ /*@__PURE__*/ /*@__PURE__*/ /*@__PURE__*/ /*@__PURE__*/ "\n .ig-tooltip-container {\n padding: 5px; \n padding: var(--tooltip-container-padding, 5px);\n background-color: white; \n background-color: var(--tooltip-container-background-color, white);\n border-style: solid; \n border-style: var(--tooltip-container-border-style, solid);\n border-width: 1px; \n border-width: var(--tooltip-container-border-width, 1px);\n color: ".concat(FontDefaults.tooltipLabelsBrush.fill, "; \n color: var(--tooltip-container-text-color, ").concat(FontDefaults.tooltipLabelsBrush.fill, ");\n pointer-events: none;\n white-space: nowrap;\n border-color: #666;\n border-color: var(--tooltip-container-border-color, #666);\n font: ").concat(FontDefaults.tooltipLabelsFontSize, "px ").concat(FontDefaults.tooltipLabelsFontFamily, ";\n font: var(--tooltip-container-font, ").concat(FontDefaults.tooltipLabelsFontSize, "px ").concat(FontDefaults.tooltipLabelsFontFamily, ");\n }\n"); var checked = /*@__PURE__*/ new WeakMap(); function ensureCss() { if (!document) { return; } if (checked.has(document)) { return; } for (var i = document.head.children.length - 1; i >= 0; i--) { var child = document.head.children[i]; if (child.tagName && child.tagName.toLowerCase() == "style" && child.hasAttribute("data-ig-tooltip-style")) { return; } } var style = document.createElement("style"); style.textContent = requiredStyle; style.setAttribute('data-ig-tooltip-style', 'true'); document.head.appendChild(style); checked.set(document, true); } var IgrTooltipContainer = /** @class */ /*@__PURE__*/ (function (_super) { __extends(IgrTooltipContainer, _super); function IgrTooltipContainer(props) { var _this = _super.call(this, props) || this; _this._template = null; _this._containerTemplate = null; _this._dataContext = null; ensureCss(); if (props.owner) { _this._currentOwner = props.owner; } return _this; } IgrTooltipContainer.prototype.render = function () { if (!this._template || !this._dataContext || !this.dataContext.item) { return null; } var ele = React.createElement(IgrTemplateContent, { dataContext: this._dataContext, template: this._template }); if (this._containerTemplate !== null) { } else { return (React.createElement("div", { className: 'ig-tooltip-container igr-tooltip-container ig-tooltip-container-background', style: {} }, ele)); } return ele; }; Object.defineProperty(IgrTooltipContainer.prototype, "currentOwner", { get: function () { return this._currentOwner; }, enumerable: false, configurable: true }); IgrTooltipContainer.prototype.shouldComponentUpdate = function (nextProps, nextState) { if (nextProps.owner !== undefined) { this._currentOwner = nextProps.owner; } return true; }; Object.defineProperty(IgrTooltipContainer.prototype, "template", { get: function () { return this._template; }, set: function (value) { this._template = value; this.setState({ template: this._template }); }, enumerable: false, configurable: true }); Object.defineProperty(IgrTooltipContainer.prototype, "containerTemplate", { get: function () { return this._containerTemplate; }, set: function (value) { this._containerTemplate = value; this.setState({ containerTemplate: this._containerTemplate }); }, enumerable: false, configurable: true }); Object.defineProperty(IgrTooltipContainer.prototype, "dataContext", { get: function () { return this._dataContext; }, set: function (value) { if (this._dataContext == null && value == null) { return; } this._dataContext = value; this.setState({ dataContext: this._dataContext }); }, enumerable: false, configurable: true }); return IgrTooltipContainer; }(React.Component)); export { IgrTooltipContainer };