@progress/kendo-react-gauges 9.0.0-develop.1 → 9.0.0-develop.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +33 -32
- package/dist/cdn/js/kendo-react-gauges.js +1 -1
- package/package-metadata.mjs +1 -1
- package/package.json +3 -3
- package/store/reducer.js +1 -1
- package/store/reducer.mjs +4 -4
- package/utils/common.js +1 -1
- package/utils/common.mjs +9 -9
package/README.md
CHANGED
|
@@ -5,10 +5,11 @@
|
|
|
5
5
|
# KendoReact Gauges Library for React
|
|
6
6
|
|
|
7
7
|
> **Important**
|
|
8
|
-
>
|
|
9
|
-
>
|
|
10
|
-
>
|
|
11
|
-
>
|
|
8
|
+
>
|
|
9
|
+
> - This package is а part of [KendoReact](https://www.telerik.com/kendo-react-ui?utm_medium=referral&utm_source=npm&utm_campaign=kendo-ui-react-trial-npm-gauges)—a commercial UI library.
|
|
10
|
+
> - You will need to install a license key when adding the package to your project. For more information, please refer to the [KendoReact My License page](https://www.telerik.com/kendo-react-ui/components/my-license/?utm_medium=referral&utm_source=npm&utm_campaign=kendo-ui-react-trial-npm-gauges).
|
|
11
|
+
> - To receive a license key, you need to either [purchase a license](https://www.telerik.com/kendo-react-ui/pricing?utm_medium=referral&utm_source=npm&utm_campaign=kendo-ui-react-trial-npm-gauges) or register for a [free trial](https://www.telerik.com/try/kendo-react-ui?utm_medium=referral&utm_source=npm&utm_campaign=kendo-ui-react-trial-npm-gauges). Doing so indicates that you [accept the KendoReact License Agreement](https://www.telerik.com/purchase/license-agreement/progress-kendoreact?utm_medium=referral&utm_source=npm&utm_campaign=kendo-ui-react-trial-npm-gauges).
|
|
12
|
+
> - The 30-day free trial gives you access to all the KendoReact components and their full functionality. Additionally, for the period of your license, you get access to our legendary technical support provided directly by the KendoReact dev team!
|
|
12
13
|
>
|
|
13
14
|
> [Start using KendoReact](https://www.telerik.com/try/kendo-react-ui?utm_medium=referral&utm_source=npm&utm_campaign=kendo-ui-react-trial-npm-gauges) and speed up your development process!
|
|
14
15
|
|
|
@@ -16,13 +17,13 @@ The React Gauges, part of KendoReact, provide a set of React components for buil
|
|
|
16
17
|
|
|
17
18
|
What's in this package (ToC):
|
|
18
19
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
- [React ArcGauge component](#react-arcgauge-component)
|
|
21
|
+
- [React CircularGauge component](#react-circulargauge-component)
|
|
22
|
+
- [React LinearGauge component](#react-lineargauge-component)
|
|
23
|
+
- [React RadialGauge component](#react-radialgauge-component)
|
|
24
|
+
- [React Gauges Library Shared Features](#react-gauges-library-shared-features)
|
|
25
|
+
- [Support Options](#support-options)
|
|
26
|
+
- [Resources](#resources)
|
|
26
27
|
|
|
27
28
|
## React ArcGauge Component
|
|
28
29
|
|
|
@@ -44,37 +45,37 @@ What's in this package (ToC):
|
|
|
44
45
|
|
|
45
46
|
Among the many features which the KendoReact Gauges deliver are:
|
|
46
47
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
- **Scale options**—You can customize the color, width range and other scale options.
|
|
49
|
+
- **Globalization**— Using the globalization feature you can format the gauges value based on the culture and use RTL.
|
|
50
|
+
- **Export**—The gauges can be exported to an image, a PDF or a SVG allowing to easily save them locally or on the server.
|
|
51
|
+
- [**Theme support**](https://www.telerik.com/kendo-react-ui/components/styling/?utm_medium=referral&utm_source=npm&utm_campaign=kendo-ui-react-trial-npm-gauges)—The KendoReact Gauges, as well as all 100+ components in the KendoReact suite, are styled in three polished themes (Bootstrap, Material, and Default) and can be further customized to match your specific design guidelines.
|
|
51
52
|
|
|
52
53
|
## Support Options
|
|
53
54
|
|
|
54
55
|
For any issues you might encounter while working with the KendoReact Gauges, use any of the available support channels:
|
|
55
56
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
- Industry-leading technical support—KendoReact paid license holders and users with an active (free) trial license can take advantage of our outstanding customer support. To submit a ticket, use [the dedicated KendoReact support system](https://www.telerik.com/account/support-tickets?utm_medium=referral&utm_source=npm&utm_campaign=kendo-ui-react-trial-npm-gauges).
|
|
58
|
+
- Product forums—The [KendoReact forums](https://www.telerik.com/forums/kendo-ui-react?utm_medium=referral&utm_source=npm&utm_campaign=kendo-ui-react-trial-npm-gauges) are part of the free support you can get from the community and from the KendoReact team.
|
|
59
|
+
- Feedback portal—The [KendoReact feedback portal](https://feedback.telerik.com/kendo-react-ui?utm_medium=referral&utm_source=npm&utm_campaign=kendo-ui-react-trial-npm-gauges) is where you can request and vote for new features to be added.
|
|
59
60
|
|
|
60
61
|
## Resources
|
|
61
62
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
63
|
+
- [Getting Started with KendoReact](https://www.telerik.com/kendo-react-ui/components/getting-started/?utm_medium=referral&utm_source=npm&utm_campaign=kendo-ui-react-trial-npm-gauges)
|
|
64
|
+
- [Getting Started with the KendoReact Gauges](https://www.telerik.com/kendo-react-ui/components/gauges/?utm_medium=referral&utm_source=npm&utm_campaign=kendo-ui-react-trial-npm-gauges)
|
|
65
|
+
- [API Reference of the KendoReact gauges](https://www.telerik.com/kendo-react-ui/components/gauges/api/?utm_medium=referral&utm_source=npm&utm_campaign=kendo-ui-react-trial-npm-gauges)
|
|
66
|
+
- [KendoReact Roadmap](https://www.telerik.com/support/whats-new/kendo-react-ui/roadmap?utm_medium=referral&utm_source=npm&utm_campaign=kendo-ui-react-trial-npm-gauges)
|
|
67
|
+
- [Blogs](https://www.telerik.com/blogs/tag/kendoreact?utm_medium=referral&utm_source=npm&utm_campaign=kendo-ui-react-trial-npm-gauges)
|
|
68
|
+
- [Demos, documentation, and component reference](https://www.telerik.com/kendo-react-ui/components/?utm_medium=referral&utm_source=npm&utm_campaign=kendo-ui-react-trial-npm-gauges)
|
|
69
|
+
- [KendoReact pricing and licensing](https://www.telerik.com/kendo-react-ui/pricing?utm_medium=referral&utm_source=npm&utm_campaign=kendo-ui-react-trial-npm-gauges)
|
|
70
|
+
- [Changelog](https://www.telerik.com/kendo-react-ui/components/changelogs/ui-for-react/?utm_medium=referral&utm_source=npm&utm_campaign=kendo-ui-react-trial-npm-gauges)
|
|
70
71
|
|
|
71
72
|
High-level component overview pages
|
|
72
73
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
74
|
+
- [React ArcGauge Component](https://www.telerik.com/kendo-react-ui/arcgauge)
|
|
75
|
+
- [React Circular Gauge Component](https://www.telerik.com/kendo-react-ui/circulargauge)
|
|
76
|
+
- [React LinearGauge Component](https://www.telerik.com/kendo-react-ui/lineargauge)
|
|
77
|
+
- [React RadialGauge Component](https://www.telerik.com/kendo-react-ui/radialgauge)
|
|
77
78
|
|
|
78
|
-
|
|
79
|
+
_Copyright © 2024 Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved._
|
|
79
80
|
|
|
80
|
-
|
|
81
|
+
_Progress, Telerik, and certain product names used herein are trademarks or registered trademarks of Progress Software Corporation and/or one of its subsidiaries or affiliates in the U.S. and/or other countries._
|
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("prop-types"),require("@progress/kendo-react-intl"),require("@progress/kendo-charts"),require("@progress/kendo-react-common"),require("@progress/kendo-drawing")):"function"==typeof define&&define.amd?define(["exports","react","prop-types","@progress/kendo-react-intl","@progress/kendo-charts","@progress/kendo-react-common","@progress/kendo-drawing"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).KendoReactGauges={},e.React,e.PropTypes,e.KendoReactIntl,e.KendoCharts,e.KendoReactCommon,e.KendoDrawing)}(this,(function(e,t,r,s,n,a,i){"use strict";function o(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var s=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,s.get?s:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var l=o(t);let c=class{constructor(e){this.store=e}setStyle(e,t){this.store.dispatch({type:"set",payload:{field:e,value:t}})}setColors(){this.mapColor("pointer.color","gauge-pointer"),this.mapColor("scale.rangePlaceholderColor","gauge-track"),this.mapColor("scale.labels.color","normal-text-color"),this.mapColor("scale.minorTicks.color","normal-text-color"),this.mapColor("scale.majorTicks.color","normal-text-color"),this.mapColor("scale.line.color","normal-text-color")}mapColor(e,t){this.setStyle(e,this.queryStyle(t).backgroundColor)}queryStyle(e){const t=this.element;return window.getComputedStyle(t.querySelector(`.k-var--${e}`))}};const u=e=>{let t,r,s=[];const n=n=>{t=e(t,n),a.canUseDOM&&(window.clearTimeout(r),r=window.setTimeout((()=>s.forEach((e=>e()))),16.666666666666668))};return n({}),{getState:()=>t,dispatch:n,subscribe:e=>(s.push(e),()=>s=s.filter((t=>t!==e)))}},g=(e,t)=>{if(!t.type)return{};switch(t.type){case"set":return p.themeItem(e,t);case"push":return Object.assign(e,t.payload);default:return e}},h=(e,t)=>{if(!t.type)return[];switch(t.type){case"add":return[...e,t.payload];case"remove":return e.filter((e=>e!==t.payload));default:return e}},p={configurationItem:(e,t)=>Object.assign(e,{[t.gaugeKey]:t.payload}),collectionConfigurationItem(e,t){let r=!1;const[s,n]=t.gaugeCollectionIdxKey.split("_"),a=e[s].map(((e,s)=>parseInt(n,10)===s?(r=!0,t.payload):e));return!1===r&&a.splice(parseInt(n,10),0,t.payload),Object.assign(e,{[s]:a})},themeItem(e,t){let r={},s=Object.assign(r,e);const{field:n,value:a}=t.payload,i=n.split(".");let o=i.shift();for(;i.length>0;)r=r[o]=r[o]||{},o=i.shift();return r[o]=a,s}},d=e=>"object"==typeof e,m=(e,t)=>{if(Object.keys(e).length!==Object.keys(t).length)return!0;for(let r in e)if("value"!==r&&e.hasOwnProperty(r)){const s=e[r],n=t[r];if(d(s)&&d(n)?m(s,n):s!==n)return!0}return!1},v=l.createContext(null);v.displayName="GaugeContext";const f={name:"@progress/kendo-react-gauges",productName:"KendoReact",productCodes:["KENDOUIREACT","KENDOUICOMPLETE"],publishDate:0,version:"",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/components/my-license/"},b=class extends l.Component{constructor(e){super(e),this.gaugeInstance=null,this.surface=null,this._element=null,this.themeStore={},this.themeUnsubscriber=Function.prototype,this.observersStore={},this.onWindowResize=()=>{null!==this.gaugeInstance&&(this.gaugeInstance.resize(),this.trigger("render",{sender:this}))},a.validatePackage(f),this.themeStore=u(g),this.observersStore=u(h),this.contextValue={observersStore:this.observersStore}}get element(){return this._element}componentDidMount(){var e;const t=(null==(e=this._element)?void 0:e.ownerDocument)||document;((e,t,r)=>{const s=new c(e);if(void 0===r)return void e.dispatch({type:"push",payload:n.chartBaseTheme()});const a=s.element=r.createElement("div");a.style.display="none",a.innerHTML='\n <div class="k-var--gauge-pointer"></div>\n <div class="k-var--gauge-track"></div>\n <div class="k-var--normal-text-color"></div>\n',r.body.appendChild(a);try{e.dispatch({type:"push",payload:n.chartBaseTheme()}),s.setColors()}finally{r.body.removeChild(s.element),delete s.element,t()}})(this.themeStore,this.instantiateCoreGauge.bind(this),t),this.themeUnsubscriber=this.themeStore.subscribe(this.refresh.bind(this)),window.addEventListener("resize",this.onWindowResize),this.trigger("render",{sender:this})}componentDidUpdate(e){const{dir:t,children:r,deriveOptionsFromParent:n,getTarget:a,gaugeConstructor:i,className:o,renderAs:l,...c}=this.props,{dir:u,children:g,deriveOptionsFromParent:h,getTarget:p,gaugeConstructor:d,className:v,renderAs:f,...b}=e;if(null!==this.gaugeInstance){const r=s.provideIntlService(this),n=this.gaugeInstance.contextService,a=r.locale!==n._intlService.locale,i=((e,t)=>{if(!e||!t||(e=[].concat(e),t=[].concat(t),e.length!==t.length))return!0;for(let r=0;r<e.length;r++)if(m(e[r],t[r]))return!0;return!1})(b,c),o=c;a&&(this.gaugeInstance.contextService._intlService=r,this.gaugeInstance.contextService.format._intlService=r,i||this.gaugeInstance.noTransitionsRedraw()),i||(l||"svg")!==(f||"svg")?this.refresh():Object.keys(c).indexOf("pointer")>-1?Array.isArray(o.pointer)?this.refreshAllValues(o.pointer.map((e=>e.value))):this.refreshValue((o.pointer||{}).value):this.refreshValue(o.value),e.dir!==t&&this.gaugeInstance.setDirection(this.getDirection(t)),this.trigger("render",{sender:this})}}componentWillUnmount(){this.themeUnsubscriber();const e=this.gaugeInstance&&this.gaugeInstance.surfaceElement;e&&e.parentNode&&e.parentNode.removeChild(e),null!==this.gaugeInstance&&(this.gaugeInstance.destroy(),this.gaugeInstance=null),window.removeEventListener("resize",this.onWindowResize)}render(){const{style:e={},className:t,children:r}=this.props,s=Object.assign({},e,{position:"relative"});return l.createElement(v.Provider,{value:this.contextValue},l.createElement("div",{style:s,ref:e=>this._element=e,className:t},r))}instantiateCoreGauge(){const{dir:e,gaugeConstructor:t}=this.props,r=this.getGaugeOptions();this.gaugeInstance=new t(this.element,r,this.themeStore.getState(),{rtl:this.getDirection(e),intlService:s.provideIntlService(this),sender:this})}refresh(){if(null!==this.gaugeInstance){const e=this.themeStore.getState(),t=this.getGaugeOptions();this.gaugeInstance.setOptions(t,e)}}refreshValue(e){this.gaugeInstance.value(e)}refreshAllValues(e){this.gaugeInstance.allValues(e)}getDirection(e){return"rtl"===(void 0!==e?e:a.canUseDOM&&window.getComputedStyle(this.element).direction||"ltr")}getGaugeOptions(){const{renderAs:e,transitions:t,deriveOptionsFromParent:r}=this.props;let s=Object.assign({renderAs:e,transitions:t});return r&&(s=r(s)),s}trigger(e,t){const r=this.observersStore.getState();for(let s=0;s<r.length;s++)r[s].trigger(e,t)}};b.propTypes={dir:r.string,renderAs:r.oneOf(["svg","canvas"])},b.defaultProps={renderAs:"svg"};let y=b;s.registerForIntl(y);const C=class extends l.Component{constructor(e,t){super(e,t),this.state={arcCenterStyles:null,arcCenterValue:{value:0,color:""}},this._element=null,this.gaugeObserver=new n.InstanceObserver(this,{render:"onRender"}),t.observersStore.dispatch({type:"add",payload:this.gaugeObserver})}render(){const{render:e}=this.props,{arcCenterStyles:t,arcCenterValue:r}=this.state,s=t||{zIndex:-1};let n=null;return e&&(n=l.createElement("div",{className:"k-arcgauge-label",ref:e=>this._element=e,style:s},e(r.value,r.color))),n}onRender(e){if(!this._element)return;const t=e.sender.gaugeInstance,r=this._element.offsetWidth,s=this._element.offsetHeight,n=t.centerLabelPosition(r,s);this.setState({arcCenterStyles:{left:n.left,top:n.top},arcCenterValue:{value:t.value(),color:t.currentColor()}})}};C.contextType=v;let I=C;class O extends l.Component{constructor(){super(...arguments),this._baseGauge=null,this.gaugeType=n.ArcGauge,this.getTarget=()=>this,this.deriveOptionsFromParent=e=>{const{value:t,color:r,colors:s,opacity:n,scale:a}=this.props;return Object.assign({},e,{value:t,color:r,colors:s,opacity:n,scale:a})}}get gaugeInstance(){return this._baseGauge?this._baseGauge.gaugeInstance:null}get surface(){return this._baseGauge?this._baseGauge.surface:null}get element(){return this._baseGauge?this._baseGauge.element:null}render(){const{children:e,arcCenterRender:t,centerRender:r,className:s,...n}=this.props;return l.createElement(y,{...n,deriveOptionsFromParent:this.deriveOptionsFromParent,ref:e=>this._baseGauge=e,gaugeConstructor:this.gaugeType,getTarget:this.getTarget,className:a.classNames("k-gauge k-arcgauge",s)},e,l.createElement(I,{render:r||t}))}exportVisual(e){return null!==this.gaugeInstance&&this.element?i.drawDOM(this.element,e):Promise.resolve(new i.Group)}}let G=class extends l.Component{constructor(){super(...arguments),this._baseGauge=null,this.getTarget=()=>this,this.deriveOptionsFromParent=e=>{const{pointer:t,scale:r}=this.props;return Object.assign({},e,{pointer:t,scale:r})}}get gaugeInstance(){return null!==this._baseGauge?this._baseGauge.gaugeInstance:null}get surface(){return null!==this._baseGauge?this._baseGauge.surface:null}get element(){return null!==this._baseGauge?this._baseGauge.element:null}render(){const{children:e,className:t,...r}=this.props;return l.createElement(y,{...r,deriveOptionsFromParent:this.deriveOptionsFromParent,ref:e=>this._baseGauge=e,gaugeConstructor:n.LinearGauge,getTarget:this.getTarget,className:a.classNames("k-gauge",t)},e)}exportVisual(e){return null!==this.gaugeInstance?Promise.resolve(this.gaugeInstance.exportVisual(e)):Promise.resolve(new i.Group)}};class _ extends l.Component{constructor(){super(...arguments),this._baseGauge=null,this.getTarget=()=>this,this.deriveOptionsFromParent=e=>{const{pointer:t,scale:r}=this.props;return Object.assign({},e,{pointer:t,scale:r})}}get gaugeInstance(){return null!==this._baseGauge?this._baseGauge.gaugeInstance:null}get surface(){return null!==this._baseGauge?this._baseGauge.surface:null}get element(){return null!==this._baseGauge?this._baseGauge.element:null}render(){const{children:e,className:t,...r}=this.props;return l.createElement(y,{...r,deriveOptionsFromParent:this.deriveOptionsFromParent,ref:e=>this._baseGauge=e,gaugeConstructor:n.RadialGauge,getTarget:this.getTarget,className:a.classNames("k-gauge",t)},e)}exportVisual(e){return null!==this.gaugeInstance?Promise.resolve(this.gaugeInstance.exportVisual(e)):Promise.resolve(new i.Group)}}e.ArcGauge=O,e.CircularGauge=class extends O{constructor(){super(...arguments),this.gaugeType=n.CircularGauge}},e.LinearGauge=G,e.RadialGauge=_}));
|
|
8
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("prop-types"),require("@progress/kendo-react-intl"),require("@progress/kendo-charts"),require("@progress/kendo-react-common"),require("@progress/kendo-drawing")):"function"==typeof define&&define.amd?define(["exports","react","prop-types","@progress/kendo-react-intl","@progress/kendo-charts","@progress/kendo-react-common","@progress/kendo-drawing"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).KendoReactGauges={},e.React,e.PropTypes,e.KendoReactIntl,e.KendoCharts,e.KendoReactCommon,e.KendoDrawing)}(this,(function(e,t,r,s,n,a,i){"use strict";function o(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var s=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,s.get?s:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var l=o(t);let c=class{constructor(e){this.store=e}setStyle(e,t){this.store.dispatch({type:"set",payload:{field:e,value:t}})}setColors(){this.mapColor("pointer.color","gauge-pointer"),this.mapColor("scale.rangePlaceholderColor","gauge-track"),this.mapColor("scale.labels.color","normal-text-color"),this.mapColor("scale.minorTicks.color","normal-text-color"),this.mapColor("scale.majorTicks.color","normal-text-color"),this.mapColor("scale.line.color","normal-text-color")}mapColor(e,t){this.setStyle(e,this.queryStyle(t).backgroundColor)}queryStyle(e){const t=this.element;return window.getComputedStyle(t.querySelector(`.k-var--${e}`))}};const u=e=>{let t,r,s=[];const n=n=>{t=e(t,n),a.canUseDOM&&(window.clearTimeout(r),r=window.setTimeout((()=>s.forEach((e=>e()))),16.666666666666668))};return n({}),{getState:()=>t,dispatch:n,subscribe:e=>(s.push(e),()=>s=s.filter((t=>t!==e)))}},g=(e,t)=>{if(!t.type)return{};switch(t.type){case"set":return p.themeItem(e,t);case"push":return Object.assign(e,t.payload);default:return e}},h=(e,t)=>{if(!t.type)return[];switch(t.type){case"add":return[...e,t.payload];case"remove":return e.filter((e=>e!==t.payload));default:return e}},p={configurationItem:(e,t)=>Object.assign(e,{[t.gaugeKey]:t.payload}),collectionConfigurationItem(e,t){let r=!1;const[s,n]=t.gaugeCollectionIdxKey.split("_"),a=e[s].map(((e,s)=>parseInt(n,10)===s?(r=!0,t.payload):e));return!1===r&&a.splice(parseInt(n,10),0,t.payload),Object.assign(e,{[s]:a})},themeItem(e,t){let r={};const s=Object.assign(r,e),{field:n,value:a}=t.payload,i=n.split(".");let o=i.shift();for(;i.length>0;)r=r[o]=r[o]||{},o=i.shift();return r[o]=a,s}},d=e=>"object"==typeof e,m=(e,t)=>{if(Object.keys(e).length!==Object.keys(t).length)return!0;for(const r in e)if("value"!==r&&e.hasOwnProperty(r)){const s=e[r],n=t[r];if(d(s)&&d(n)?m(s,n):s!==n)return!0}return!1},v=l.createContext(null);v.displayName="GaugeContext";const f={name:"@progress/kendo-react-gauges",productName:"KendoReact",productCodes:["KENDOUIREACT","KENDOUICOMPLETE"],publishDate:0,version:"",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/components/my-license/"},b=class extends l.Component{constructor(e){super(e),this.gaugeInstance=null,this.surface=null,this._element=null,this.themeStore={},this.themeUnsubscriber=Function.prototype,this.observersStore={},this.onWindowResize=()=>{null!==this.gaugeInstance&&(this.gaugeInstance.resize(),this.trigger("render",{sender:this}))},a.validatePackage(f),this.themeStore=u(g),this.observersStore=u(h),this.contextValue={observersStore:this.observersStore}}get element(){return this._element}componentDidMount(){var e;const t=(null==(e=this._element)?void 0:e.ownerDocument)||document;((e,t,r)=>{const s=new c(e);if(void 0===r)return void e.dispatch({type:"push",payload:n.chartBaseTheme()});const a=s.element=r.createElement("div");a.style.display="none",a.innerHTML='\n <div class="k-var--gauge-pointer"></div>\n <div class="k-var--gauge-track"></div>\n <div class="k-var--normal-text-color"></div>\n',r.body.appendChild(a);try{e.dispatch({type:"push",payload:n.chartBaseTheme()}),s.setColors()}finally{r.body.removeChild(s.element),delete s.element,t()}})(this.themeStore,this.instantiateCoreGauge.bind(this),t),this.themeUnsubscriber=this.themeStore.subscribe(this.refresh.bind(this)),window.addEventListener("resize",this.onWindowResize),this.trigger("render",{sender:this})}componentDidUpdate(e){const{dir:t,children:r,deriveOptionsFromParent:n,getTarget:a,gaugeConstructor:i,className:o,renderAs:l,...c}=this.props,{dir:u,children:g,deriveOptionsFromParent:h,getTarget:p,gaugeConstructor:d,className:v,renderAs:f,...b}=e;if(null!==this.gaugeInstance){const r=s.provideIntlService(this),n=this.gaugeInstance.contextService,a=r.locale!==n._intlService.locale,i=((e,t)=>{if(!e||!t||(e=[].concat(e),t=[].concat(t),e.length!==t.length))return!0;for(let r=0;r<e.length;r++)if(m(e[r],t[r]))return!0;return!1})(b,c),o=c;a&&(this.gaugeInstance.contextService._intlService=r,this.gaugeInstance.contextService.format._intlService=r,i||this.gaugeInstance.noTransitionsRedraw()),i||(l||"svg")!==(f||"svg")?this.refresh():Object.keys(c).indexOf("pointer")>-1?Array.isArray(o.pointer)?this.refreshAllValues(o.pointer.map((e=>e.value))):this.refreshValue((o.pointer||{}).value):this.refreshValue(o.value),e.dir!==t&&this.gaugeInstance.setDirection(this.getDirection(t)),this.trigger("render",{sender:this})}}componentWillUnmount(){this.themeUnsubscriber();const e=this.gaugeInstance&&this.gaugeInstance.surfaceElement;e&&e.parentNode&&e.parentNode.removeChild(e),null!==this.gaugeInstance&&(this.gaugeInstance.destroy(),this.gaugeInstance=null),window.removeEventListener("resize",this.onWindowResize)}render(){const{style:e={},className:t,children:r}=this.props,s=Object.assign({},e,{position:"relative"});return l.createElement(v.Provider,{value:this.contextValue},l.createElement("div",{style:s,ref:e=>this._element=e,className:t},r))}instantiateCoreGauge(){const{dir:e,gaugeConstructor:t}=this.props,r=this.getGaugeOptions();this.gaugeInstance=new t(this.element,r,this.themeStore.getState(),{rtl:this.getDirection(e),intlService:s.provideIntlService(this),sender:this})}refresh(){if(null!==this.gaugeInstance){const e=this.themeStore.getState(),t=this.getGaugeOptions();this.gaugeInstance.setOptions(t,e)}}refreshValue(e){this.gaugeInstance.value(e)}refreshAllValues(e){this.gaugeInstance.allValues(e)}getDirection(e){return"rtl"===(void 0!==e?e:a.canUseDOM&&window.getComputedStyle(this.element).direction||"ltr")}getGaugeOptions(){const{renderAs:e,transitions:t,deriveOptionsFromParent:r}=this.props;let s=Object.assign({renderAs:e,transitions:t});return r&&(s=r(s)),s}trigger(e,t){const r=this.observersStore.getState();for(let s=0;s<r.length;s++)r[s].trigger(e,t)}};b.propTypes={dir:r.string,renderAs:r.oneOf(["svg","canvas"])},b.defaultProps={renderAs:"svg"};let y=b;s.registerForIntl(y);const C=class extends l.Component{constructor(e,t){super(e,t),this.state={arcCenterStyles:null,arcCenterValue:{value:0,color:""}},this._element=null,this.gaugeObserver=new n.InstanceObserver(this,{render:"onRender"}),t.observersStore.dispatch({type:"add",payload:this.gaugeObserver})}render(){const{render:e}=this.props,{arcCenterStyles:t,arcCenterValue:r}=this.state,s=t||{zIndex:-1};let n=null;return e&&(n=l.createElement("div",{className:"k-arcgauge-label",ref:e=>this._element=e,style:s},e(r.value,r.color))),n}onRender(e){if(!this._element)return;const t=e.sender.gaugeInstance,r=this._element.offsetWidth,s=this._element.offsetHeight,n=t.centerLabelPosition(r,s);this.setState({arcCenterStyles:{left:n.left,top:n.top},arcCenterValue:{value:t.value(),color:t.currentColor()}})}};C.contextType=v;let I=C;class O extends l.Component{constructor(){super(...arguments),this._baseGauge=null,this.gaugeType=n.ArcGauge,this.getTarget=()=>this,this.deriveOptionsFromParent=e=>{const{value:t,color:r,colors:s,opacity:n,scale:a}=this.props;return Object.assign({},e,{value:t,color:r,colors:s,opacity:n,scale:a})}}get gaugeInstance(){return this._baseGauge?this._baseGauge.gaugeInstance:null}get surface(){return this._baseGauge?this._baseGauge.surface:null}get element(){return this._baseGauge?this._baseGauge.element:null}render(){const{children:e,arcCenterRender:t,centerRender:r,className:s,...n}=this.props;return l.createElement(y,{...n,deriveOptionsFromParent:this.deriveOptionsFromParent,ref:e=>this._baseGauge=e,gaugeConstructor:this.gaugeType,getTarget:this.getTarget,className:a.classNames("k-gauge k-arcgauge",s)},e,l.createElement(I,{render:r||t}))}exportVisual(e){return null!==this.gaugeInstance&&this.element?i.drawDOM(this.element,e):Promise.resolve(new i.Group)}}let G=class extends l.Component{constructor(){super(...arguments),this._baseGauge=null,this.getTarget=()=>this,this.deriveOptionsFromParent=e=>{const{pointer:t,scale:r}=this.props;return Object.assign({},e,{pointer:t,scale:r})}}get gaugeInstance(){return null!==this._baseGauge?this._baseGauge.gaugeInstance:null}get surface(){return null!==this._baseGauge?this._baseGauge.surface:null}get element(){return null!==this._baseGauge?this._baseGauge.element:null}render(){const{children:e,className:t,...r}=this.props;return l.createElement(y,{...r,deriveOptionsFromParent:this.deriveOptionsFromParent,ref:e=>this._baseGauge=e,gaugeConstructor:n.LinearGauge,getTarget:this.getTarget,className:a.classNames("k-gauge",t)},e)}exportVisual(e){return null!==this.gaugeInstance?Promise.resolve(this.gaugeInstance.exportVisual(e)):Promise.resolve(new i.Group)}};class _ extends l.Component{constructor(){super(...arguments),this._baseGauge=null,this.getTarget=()=>this,this.deriveOptionsFromParent=e=>{const{pointer:t,scale:r}=this.props;return Object.assign({},e,{pointer:t,scale:r})}}get gaugeInstance(){return null!==this._baseGauge?this._baseGauge.gaugeInstance:null}get surface(){return null!==this._baseGauge?this._baseGauge.surface:null}get element(){return null!==this._baseGauge?this._baseGauge.element:null}render(){const{children:e,className:t,...r}=this.props;return l.createElement(y,{...r,deriveOptionsFromParent:this.deriveOptionsFromParent,ref:e=>this._baseGauge=e,gaugeConstructor:n.RadialGauge,getTarget:this.getTarget,className:a.classNames("k-gauge",t)},e)}exportVisual(e){return null!==this.gaugeInstance?Promise.resolve(this.gaugeInstance.exportVisual(e)):Promise.resolve(new i.Group)}}e.ArcGauge=O,e.CircularGauge=class extends O{constructor(){super(...arguments),this.gaugeType=n.CircularGauge}},e.LinearGauge=G,e.RadialGauge=_}));
|
package/package-metadata.mjs
CHANGED
|
@@ -10,7 +10,7 @@ const e = {
|
|
|
10
10
|
name: "@progress/kendo-react-gauges",
|
|
11
11
|
productName: "KendoReact",
|
|
12
12
|
productCodes: ["KENDOUIREACT", "KENDOUICOMPLETE"],
|
|
13
|
-
publishDate:
|
|
13
|
+
publishDate: 1729495200,
|
|
14
14
|
version: "",
|
|
15
15
|
licensingDocsUrl: "https://www.telerik.com/kendo-react-ui/components/my-license/"
|
|
16
16
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@progress/kendo-react-gauges",
|
|
3
|
-
"version": "9.0.0-develop.
|
|
3
|
+
"version": "9.0.0-develop.3",
|
|
4
4
|
"description": "React Gauges provide a set of React components for building beautiful and customizable gauges. KendoReact Gauges package",
|
|
5
5
|
"author": "Progress",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
"peerDependencies": {
|
|
25
25
|
"@progress/kendo-drawing": "^1.20.4",
|
|
26
26
|
"@progress/kendo-licensing": "^1.3.4",
|
|
27
|
-
"@progress/kendo-react-common": "9.0.0-develop.
|
|
28
|
-
"@progress/kendo-react-intl": "9.0.0-develop.
|
|
27
|
+
"@progress/kendo-react-common": "9.0.0-develop.3",
|
|
28
|
+
"@progress/kendo-react-intl": "9.0.0-develop.3",
|
|
29
29
|
"react": "^16.8.2 || ^17.0.0 || ^18.0.0",
|
|
30
30
|
"react-dom": "^16.8.2 || ^17.0.0 || ^18.0.0"
|
|
31
31
|
},
|
package/store/reducer.js
CHANGED
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=(t,e)=>{if(e.type)switch(e.type){case"set":return
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=(t,e)=>{if(e.type)switch(e.type){case"set":return i.themeItem(t,e);case"push":return Object.assign(t,e.payload);default:return t}else return{}},c=(t,e)=>{if(e.type)switch(e.type){case"add":return[...t,e.payload];case"remove":return t.filter(s=>s!==e.payload);default:return t}else return[]},i={configurationItem(t,e){return Object.assign(t,{[e.gaugeKey]:e.payload})},collectionConfigurationItem(t,e){let s=!1;const[o,n]=e.gaugeCollectionIdxKey.split("_"),u=t[o].map((r,l)=>parseInt(n,10)===l?(s=!0,e.payload):r);return s===!1&&u.splice(parseInt(n,10),0,e.payload),Object.assign(t,{[o]:u})},themeItem(t,e){let s={};const o=Object.assign(s,t),{field:n,value:u}=e.payload,r=n.split(".");let l=r.shift();for(;r.length>0;)s=s[l]=s[l]||{},l=r.shift();return s[l]=u,o}};exports.observersReducer=c;exports.themeReducer=a;
|
package/store/reducer.mjs
CHANGED
|
@@ -18,7 +18,7 @@ const u = (t, e) => {
|
|
|
18
18
|
}
|
|
19
19
|
else
|
|
20
20
|
return {};
|
|
21
|
-
},
|
|
21
|
+
}, c = (t, e) => {
|
|
22
22
|
if (e.type)
|
|
23
23
|
switch (e.type) {
|
|
24
24
|
case "add":
|
|
@@ -44,8 +44,8 @@ const u = (t, e) => {
|
|
|
44
44
|
});
|
|
45
45
|
},
|
|
46
46
|
themeItem(t, e) {
|
|
47
|
-
let s = {}
|
|
48
|
-
const { field: o, value: a } = e.payload, r = o.split(".");
|
|
47
|
+
let s = {};
|
|
48
|
+
const n = Object.assign(s, t), { field: o, value: a } = e.payload, r = o.split(".");
|
|
49
49
|
let l = r.shift();
|
|
50
50
|
for (; r.length > 0; )
|
|
51
51
|
s = s[l] = s[l] || {}, l = r.shift();
|
|
@@ -53,6 +53,6 @@ const u = (t, e) => {
|
|
|
53
53
|
}
|
|
54
54
|
};
|
|
55
55
|
export {
|
|
56
|
-
|
|
56
|
+
c as observersReducer,
|
|
57
57
|
u as themeReducer
|
|
58
58
|
};
|
package/utils/common.js
CHANGED
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=e=>typeof e=="object",
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=e=>typeof e=="object",c=(e,n)=>{if(Object.keys(e).length!==Object.keys(n).length)return!0;for(const t in e)if(t!=="value"&&e.hasOwnProperty(t)){const s=e[t],f=n[t];if(u(s)&&u(f)?c(s,f):s!==f)return!0}return!1},o=(e,n)=>{if(!e||!n||(e=[].concat(e),n=[].concat(n),e.length!==n.length))return!0;for(let t=0;t<e.length;t++)if(c(e[t],n[t]))return!0;return!1};exports.isOptionsChanged=o;
|
package/utils/common.mjs
CHANGED
|
@@ -6,21 +6,21 @@
|
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
8
|
"use client";
|
|
9
|
-
const u = (
|
|
10
|
-
if (Object.keys(
|
|
9
|
+
const u = (t) => typeof t == "object", c = (t, f) => {
|
|
10
|
+
if (Object.keys(t).length !== Object.keys(f).length)
|
|
11
11
|
return !0;
|
|
12
|
-
for (
|
|
13
|
-
if (
|
|
14
|
-
const n = e
|
|
12
|
+
for (const e in t)
|
|
13
|
+
if (e !== "value" && t.hasOwnProperty(e)) {
|
|
14
|
+
const n = t[e], s = f[e];
|
|
15
15
|
if (u(n) && u(s) ? c(n, s) : n !== s)
|
|
16
16
|
return !0;
|
|
17
17
|
}
|
|
18
18
|
return !1;
|
|
19
|
-
}, o = (
|
|
20
|
-
if (!
|
|
19
|
+
}, o = (t, f) => {
|
|
20
|
+
if (!t || !f || (t = [].concat(t), f = [].concat(f), t.length !== f.length))
|
|
21
21
|
return !0;
|
|
22
|
-
for (let
|
|
23
|
-
if (c(e
|
|
22
|
+
for (let e = 0; e < t.length; e++)
|
|
23
|
+
if (c(t[e], f[e]))
|
|
24
24
|
return !0;
|
|
25
25
|
return !1;
|
|
26
26
|
};
|