katoikia-app/web-ui/web-react/node_modules/primereact/chart/chart.cjs.min.js

2 lines
4.0 KiB
JavaScript

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("react"),e=require("primereact/utils");function n(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}function r(t){if(t&&t.__esModule)return t;var e=Object.create(null);return t&&Object.keys(t).forEach((function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:function(){return t[n]}})}})),e.default=t,Object.freeze(e)}var o=n(t);function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function u(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function a(t,e){return a=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},a(t,e)}function c(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&a(t,e)}function s(t){return s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},s(t)}function l(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function p(t,e){if(e&&("object"===s(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return l(t)}function f(t){return f=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},f(t)}function h(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}var y,d,b,v=function(n){c(v,t.Component);var a,s,l,y,d,b=(a=v,s=h(),function(){var t,e=f(a);if(s){var n=f(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return p(this,t)});function v(){return i(this,v),b.apply(this,arguments)}return l=v,(y=[{key:"initChart",value:function(){var t=this;Promise.resolve().then((function(){return r(require("chart.js/auto"))})).then((function(e){t.chart&&(t.chart.destroy(),t.chart=null),e&&e.default&&(t.chart=new e.default(t.canvas,{type:t.props.type,data:t.props.data,options:t.props.options,plugins:t.props.plugins}))}))}},{key:"getCanvas",value:function(){return this.canvas}},{key:"getChart",value:function(){return this.chart}},{key:"getBase64Image",value:function(){return this.chart.toBase64Image()}},{key:"generateLegend",value:function(){this.chart&&this.chart.generateLegend()}},{key:"refresh",value:function(){this.chart&&this.chart.update()}},{key:"reinit",value:function(){this.initChart()}},{key:"shouldComponentUpdate",value:function(t){return t.data!==this.props.data||t.options!==this.props.options||t.type!==this.props.type}},{key:"componentDidMount",value:function(){this.initChart()}},{key:"componentDidUpdate",value:function(){this.reinit()}},{key:"componentWillUnmount",value:function(){this.chart&&(this.chart.destroy(),this.chart=null)}},{key:"render",value:function(){var t=this,n=e.classNames("p-chart",this.props.className),r=Object.assign({width:this.props.width,height:this.props.height},this.props.style);return o.default.createElement("div",{id:this.props.id,style:r,className:n},o.default.createElement("canvas",{ref:function(e){t.canvas=e},width:this.props.width,height:this.props.height}))}}])&&u(l.prototype,y),d&&u(l,d),Object.defineProperty(l,"prototype",{writable:!1}),v}();b={id:null,type:null,data:null,options:null,plugins:null,width:null,height:null,style:null,className:null},(d="defaultProps")in(y=v)?Object.defineProperty(y,d,{value:b,enumerable:!0,configurable:!0,writable:!0}):y[d]=b,exports.Chart=v;