UNPKG

@progress/kendo-react-gauges

Version:

React Gauges provide a set of React components for building beautiful and customizable gauges. KendoReact Gauges package

79 lines (78 loc) 2.43 kB
/** * @license *------------------------------------------------------------------------------------------- * Copyright © 2025 Progress Software Corporation. All rights reserved. * Licensed under commercial license. See LICENSE.md in the package root for more information *------------------------------------------------------------------------------------------- */ import * as u from "react"; import { BaseGauge as i } from "./BaseGauge.mjs"; import { ArcGauge as g } from "@progress/kendo-charts"; import { ArcCenter as o } from "./ArcCenter.mjs"; import { drawDOM as c, Group as l } from "@progress/kendo-drawing"; import { classNames as m } from "@progress/kendo-react-common"; class _ extends u.Component { constructor() { super(...arguments), this._baseGauge = null, this.gaugeType = g, this.getTarget = () => this, this.deriveOptionsFromParent = (e) => { const { value: r, color: t, colors: s, opacity: a, scale: n } = this.props; return Object.assign({}, e, { value: r, color: t, colors: s, opacity: a, scale: n }); }; } /** * @hidden */ get gaugeInstance() { return this._baseGauge ? this._baseGauge.gaugeInstance : null; } /** * The Drawing `Surface` of the Gauge. */ get surface() { return this._baseGauge ? this._baseGauge.surface : null; } /** * The DOM element of the Gauge. */ get element() { return this._baseGauge ? this._baseGauge.element : null; } /** * @hidden */ render() { const { children: e, arcCenterRender: r, centerRender: t, className: s, ...a } = this.props; return /* @__PURE__ */ u.createElement( i, { ...a, deriveOptionsFromParent: this.deriveOptionsFromParent, ref: (n) => { this._baseGauge = n; }, gaugeConstructor: this.gaugeType, getTarget: this.getTarget, className: m("k-gauge k-arcgauge", s) }, e, /* @__PURE__ */ u.createElement(o, { render: t || r }) ); } /** * Exports a Gauge component as a Drawing `Scene`. * * @param {any} options - The parameters for the export operation. * @returns {Promise<Group>} - A promise that returns the root `Group` of the scene. */ exportVisual(e) { return this.gaugeInstance !== null && this.element ? c(this.element, e) : Promise.resolve(new l()); } } export { _ as ArcGauge };