UNPKG

@progress/kendo-react-gauges

Version:

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

74 lines (73 loc) 2.19 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 s from "react"; import { BaseGauge as n } from "./BaseGauge.mjs"; import { LinearGauge as u } from "@progress/kendo-charts"; import { Group as i } from "@progress/kendo-drawing"; import { classNames as g } from "@progress/kendo-react-common"; class h extends s.Component { constructor() { super(...arguments), this._baseGauge = null, this.getTarget = () => this, this.deriveOptionsFromParent = (e) => { const { pointer: r, scale: t } = this.props; return Object.assign({}, e, { pointer: r, scale: t }); }; } /** * @hidden */ get gaugeInstance() { return this._baseGauge !== null ? this._baseGauge.gaugeInstance : null; } /** * The Drawing `Surface` of the Gauge. */ get surface() { return this._baseGauge !== null ? this._baseGauge.surface : null; } /** * The DOM element of the Gauge. */ get element() { return this._baseGauge !== null ? this._baseGauge.element : null; } /** * @hidden */ render() { const { children: e, className: r, ...t } = this.props; return /* @__PURE__ */ s.createElement( n, { ...t, deriveOptionsFromParent: this.deriveOptionsFromParent, ref: (a) => { this._baseGauge = a; }, gaugeConstructor: u, getTarget: this.getTarget, className: g("k-gauge", r) }, e ); } /** * 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 ? Promise.resolve(this.gaugeInstance.exportVisual(e)) : Promise.resolve(new i()); } } export { h as LinearGauge };