react-apexcharts 1.4.1 → 1.4.2

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.
@@ -0,0 +1,20 @@
1
+ name: Mark stale issues and pull requests
2
+ on:
3
+ schedule:
4
+ - cron: '21 14 * * *'
5
+ jobs:
6
+ stale:
7
+ runs-on: ubuntu-latest
8
+ permissions:
9
+ issues: write
10
+ pull-requests: write
11
+ steps:
12
+ - uses: actions/stale@v9
13
+ with:
14
+ repo-token: ${{ secrets.GITHUB_TOKEN }}
15
+ stale-issue-message: 'This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.'
16
+ stale-pr-message: 'This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.'
17
+ stale-issue-label: 'no-issue-activity'
18
+ stale-pr-label: 'no-pr-activity'
19
+ exempt-issue-labels: 'bug,high-priority'
20
+ operations-per-run: 100
@@ -1 +1 @@
1
- var ReactApexChart=function(t,e,r){"use strict";t=t&&t.hasOwnProperty("default")?t.default:t;var i="default"in e?e.default:e;r=r&&r.hasOwnProperty("default")?r.default:r;var n=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i])}return t};window.ApexCharts=t;class s extends e.Component{constructor(t){super(t),i.createRef?this.chartRef=i.createRef():this.setRef=(t=>this.chartRef=t),this.chart=null}render(){const t=function(t,e){var r={};for(var i in t)e.indexOf(i)>=0||Object.prototype.hasOwnProperty.call(t,i)&&(r[i]=t[i]);return r}(this.props,[]);return i.createElement("div",n({ref:i.createRef?this.chartRef:this.setRef},t))}componentDidMount(){const e=i.createRef?this.chartRef.current:this.chartRef;this.chart=new t(e,this.getConfig()),this.chart.render()}getConfig(){const{type:t,height:e,width:r,series:i,options:n}=this.props,s={chart:{type:t,height:e,width:r},series:i};return this.extend(n,s)}isObject(t){return t&&"object"==typeof t&&!Array.isArray(t)&&null!=t}extend(t,e){"function"!=typeof Object.assign&&(Object.assign=function(t){if(void 0===t||null===t)throw new TypeError("Cannot convert undefined or null to object");let e=Object(t);for(let t=1;t<arguments.length;t++){let r=arguments[t];if(void 0!==r&&null!==r)for(let t in r)r.hasOwnProperty(t)&&(e[t]=r[t])}return e});let r=Object.assign({},t);return this.isObject(t)&&this.isObject(e)&&Object.keys(e).forEach(i=>{this.isObject(e[i])&&i in t?r[i]=this.extend(t[i],e[i]):Object.assign(r,{[i]:e[i]})}),r}componentDidUpdate(t){if(!this.chart)return null;const{options:e,series:r,height:i,width:n}=this.props,s=JSON.stringify(t.options),h=JSON.stringify(t.series),o=JSON.stringify(e),a=JSON.stringify(r);s===o&&h===a&&i===t.height&&n===t.width||(h===a?this.chart.updateOptions(this.getConfig()):s===o&&i===t.height&&n===t.width?this.chart.updateSeries(r):this.chart.updateOptions(this.getConfig()))}componentWillUnmount(){this.chart&&"function"==typeof this.chart.destroy&&this.chart.destroy()}}return s.propTypes={type:r.string.isRequired,width:r.oneOfType([r.string,r.number]),height:r.oneOfType([r.string,r.number]),series:r.array.isRequired,options:r.object.isRequired},s.defaultProps={type:"line",width:"100%",height:"auto"},s}(ApexCharts,React,PropTypes);
1
+ var ReactApexChart=function(e,r,t){"use strict";function n(e,r,t){return(r=function(e){var r=function(e,r){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,r||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(e)}(e,"string");return"symbol"==typeof r?r:r+""}(r))in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function i(){return i=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)({}).hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e},i.apply(null,arguments)}function o(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function u(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?o(Object(t),!0).forEach((function(r){n(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):o(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function c(e){return c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},c(e)}var f=["type","width","height","series","options"];function s(t){var o=t.type,a=void 0===o?"line":o,p=t.width,y=void 0===p?"100%":p,l=t.height,b=void 0===l?"auto":l,O=t.series,v=t.options,g=function(e,r){if(null==e)return{};var t,n,i=function(e,r){if(null==e)return{};var t={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(r.includes(n))continue;t[n]=e[n]}return t}(e,r);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)t=o[n],r.includes(t)||{}.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}return i}(t,f),h=e.useRef(null),d=e.useRef(null);e.useEffect((function(){var e=h.current;return d.current=new r(e,P()),d.current.render(),function(){d.current&&"function"==typeof d.current.destroy&&d.current.destroy()}}),[]),e.useEffect((function(){var e=JSON.stringify(d.current.options),r=JSON.stringify(d.current.series),t=JSON.stringify(v),n=JSON.stringify(O);e===t&&r===n&&b===d.current.height&&y===d.current.width||(r===n?d.current.updateOptions(P()):d.current.updateSeries(O))}),[v,O,b,y]);var m,j,w,P=function(){return E(v,{chart:{type:a,height:b,width:y},series:O})},S=function(e){return e&&"object"===c(e)&&!Array.isArray(e)},E=function(e,r){var t=u({},e);return S(e)&&S(r)&&Object.keys(r).forEach((function(i){S(r[i])&&i in e?t[i]=E(e[i],r[i]):Object.assign(t,n({},i,r[i]))})),t},R=(m=g,j=Object.keys(s.propTypes),w=u({},m),j.forEach((function(e){delete w[e]})),w);return React.createElement("div",i({ref:h},R))}return s.propTypes={type:t.string.isRequired,series:t.array.isRequired,options:t.object.isRequired,width:t.oneOfType([t.string,t.number]),height:t.oneOfType([t.string,t.number])},s}(React,ApexCharts,PropTypes);
@@ -1,139 +1,107 @@
1
- import ApexCharts from 'apexcharts/dist/apexcharts.common'
2
- import React, { Component } from 'react'
3
- import PropTypes from 'prop-types'
1
+ "use strict";
4
2
 
5
- window.ApexCharts = ApexCharts
6
-
7
- export default class Charts extends Component {
8
- constructor (props) {
9
- super(props)
10
- if (React.createRef) {
11
- this.chartRef = React.createRef()
12
- } else {
13
- this.setRef = el => this.chartRef = el
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = Charts;
7
+ var _apexcharts = _interopRequireDefault(require("apexcharts"));
8
+ var _react = _interopRequireWildcard(require("react"));
9
+ var _propTypes = _interopRequireDefault(require("prop-types"));
10
+ var _excluded = ["type", "width", "height", "series", "options"];
11
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
12
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
13
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
14
+ function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
15
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
16
+ function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var s = Object.getOwnPropertySymbols(e); for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
17
+ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.includes(n)) continue; t[n] = r[n]; } return t; }
18
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
19
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
20
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
21
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
22
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
23
+ function omit(obj, keysToRemove) {
24
+ var newObj = _objectSpread({}, obj);
25
+ keysToRemove.forEach(function (key) {
26
+ delete newObj[key];
27
+ });
28
+ return newObj;
29
+ }
30
+ function Charts(_ref) {
31
+ var _ref$type = _ref.type,
32
+ type = _ref$type === void 0 ? "line" : _ref$type,
33
+ _ref$width = _ref.width,
34
+ width = _ref$width === void 0 ? "100%" : _ref$width,
35
+ _ref$height = _ref.height,
36
+ height = _ref$height === void 0 ? "auto" : _ref$height,
37
+ series = _ref.series,
38
+ options = _ref.options,
39
+ restProps = _objectWithoutProperties(_ref, _excluded);
40
+ var chartRef = (0, _react.useRef)(null);
41
+ var chart = (0, _react.useRef)(null);
42
+ (0, _react.useEffect)(function () {
43
+ var current = chartRef.current;
44
+ chart.current = new _apexcharts["default"](current, getConfig());
45
+ chart.current.render();
46
+ return function () {
47
+ if (chart.current && typeof chart.current.destroy === "function") {
48
+ chart.current.destroy();
49
+ }
50
+ };
51
+ }, []);
52
+ (0, _react.useEffect)(function () {
53
+ var prevOptions = JSON.stringify(chart.current.options);
54
+ var prevSeries = JSON.stringify(chart.current.series);
55
+ var currentOptions = JSON.stringify(options);
56
+ var currentSeries = JSON.stringify(series);
57
+ if (prevOptions !== currentOptions || prevSeries !== currentSeries || height !== chart.current.height || width !== chart.current.width) {
58
+ if (prevSeries === currentSeries) {
59
+ chart.current.updateOptions(getConfig());
60
+ } else {
61
+ chart.current.updateSeries(series);
62
+ }
14
63
  }
15
- this.chart = null
16
- }
17
-
18
- render () {
19
- const { ...props } = this.props
20
- return React.createElement('div', {
21
- ref: React.createRef
22
- ? this.chartRef
23
- : this.setRef,
24
- ...props
25
- })
26
- }
27
-
28
- componentDidMount () {
29
- const current = React.createRef ? this.chartRef.current : this.chartRef
30
- this.chart = new ApexCharts(current, this.getConfig())
31
- this.chart.render()
32
- }
33
-
34
- getConfig () {
35
- const { type, height, width, series, options } = this.props
36
- const newOptions = {
64
+ }, [options, series, height, width]);
65
+ var getConfig = function getConfig() {
66
+ var newOptions = {
37
67
  chart: {
38
- type,
39
- height,
40
- width
68
+ type: type,
69
+ height: height,
70
+ width: width
41
71
  },
42
- series
43
- }
44
-
45
- return this.extend(options, newOptions)
46
- }
47
-
48
- isObject(item) {
49
- return (
50
- item && typeof item === 'object' && !Array.isArray(item) && item != null
51
- )
52
- }
53
-
54
- extend (target, source) {
55
- if (typeof Object.assign !== 'function') {
56
- (function () {
57
- Object.assign = function (target) {
58
- // We must check against these specific cases.
59
- if (target === undefined || target === null) {
60
- throw new TypeError('Cannot convert undefined or null to object')
61
- }
62
-
63
- let output = Object(target)
64
- for (let index = 1; index < arguments.length; index++) {
65
- let source = arguments[index]
66
- if (source !== undefined && source !== null) {
67
- for (let nextKey in source) {
68
- if (source.hasOwnProperty(nextKey)) {
69
- output[nextKey] = source[nextKey]
70
- }
71
- }
72
- }
73
- }
74
- return output
75
- }
76
- })()
77
- }
78
-
79
- let output = Object.assign({}, target)
80
- if (this.isObject(target) && this.isObject(source)) {
81
- Object.keys(source).forEach((key) => {
82
- if (this.isObject(source[key])) {
72
+ series: series
73
+ };
74
+ return _extend(options, newOptions);
75
+ };
76
+ var isObject = function isObject(item) {
77
+ return item && _typeof(item) === "object" && !Array.isArray(item);
78
+ };
79
+ var _extend = function extend(target, source) {
80
+ var output = _objectSpread({}, target);
81
+ if (isObject(target) && isObject(source)) {
82
+ Object.keys(source).forEach(function (key) {
83
+ if (isObject(source[key])) {
83
84
  if (!(key in target)) {
84
- Object.assign(output, {
85
- [key]: source[key]
86
- })
85
+ Object.assign(output, _defineProperty({}, key, source[key]));
87
86
  } else {
88
- output[key] = this.extend(target[key], source[key])
87
+ output[key] = _extend(target[key], source[key]);
89
88
  }
90
89
  } else {
91
- Object.assign(output, {
92
- [key]: source[key]
93
- })
90
+ Object.assign(output, _defineProperty({}, key, source[key]));
94
91
  }
95
- })
92
+ });
96
93
  }
97
- return output
98
- }
99
-
100
- componentDidUpdate (prevProps) {
101
- if (!this.chart) return null
102
- const { options, series } = this.props
103
- const prevOptions = JSON.stringify(prevProps.options)
104
- const prevSeries = JSON.stringify(prevProps.series)
105
- const currentOptions = JSON.stringify(options)
106
- const currentSeries = JSON.stringify(series)
107
-
108
- if (prevOptions !== currentOptions || prevSeries !== currentSeries) {
109
- if (prevSeries === currentSeries) {
110
- // series is not changed,but options are changed
111
- this.chart.updateOptions(this.getConfig())
112
- } else if (prevOptions === currentOptions) {
113
- // options are not changed, just the series is changed
114
- this.chart.updateSeries(series)
115
- } else {
116
- // both might be changed
117
- this.chart.updateOptions(this.getConfig())
118
- }
119
- }
120
- }
121
-
122
- componentWillUnmount () {
123
- if (this.chart && typeof this.chart.destroy === 'function') this.chart.destroy()
124
- }
94
+ return output;
95
+ };
96
+ var rest = omit(restProps, Object.keys(Charts.propTypes));
97
+ return /*#__PURE__*/_react["default"].createElement("div", _extends({
98
+ ref: chartRef
99
+ }, rest));
125
100
  }
126
-
127
101
  Charts.propTypes = {
128
- type: PropTypes.string.isRequired,
129
- width: PropTypes.any,
130
- height: PropTypes.any,
131
- series: PropTypes.array.isRequired,
132
- options: PropTypes.object.isRequired
133
- }
134
-
135
- Charts.defaultProps = {
136
- type: 'line',
137
- width: '100%',
138
- height: 'auto'
139
- }
102
+ type: _propTypes["default"].string.isRequired,
103
+ series: _propTypes["default"].array.isRequired,
104
+ options: _propTypes["default"].object.isRequired,
105
+ width: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].number]),
106
+ height: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].number])
107
+ };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r,n=arguments[t];for(r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},_createClass=function(){function n(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),e}}(),_apexcharts=require("apexcharts"),_apexcharts2=_interopRequireDefault(_apexcharts),_react=require("react"),_react2=_interopRequireDefault(_react),_propTypes=require("prop-types"),_propTypes2=_interopRequireDefault(_propTypes);function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _defineProperty(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _objectWithoutProperties(e,t){var r,n={};for(r in e)0<=t.indexOf(r)||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(e,t){if(e)return!t||"object"!=typeof t&&"function"!=typeof t?e:t;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}window.ApexCharts=_apexcharts2.default;var Charts=function(){function r(e){_classCallCheck(this,r);var t=_possibleConstructorReturn(this,(r.__proto__||Object.getPrototypeOf(r)).call(this,e));return _react2.default.createRef?t.chartRef=_react2.default.createRef():t.setRef=function(e){return t.chartRef=e},t.chart=null,t}return _inherits(r,_react.Component),_createClass(r,[{key:"render",value:function(){var e=_objectWithoutProperties(this.props,[]);return _react2.default.createElement("div",_extends({ref:_react2.default.createRef?this.chartRef:this.setRef},e))}},{key:"componentDidMount",value:function(){var e=_react2.default.createRef?this.chartRef.current:this.chartRef;this.chart=new _apexcharts2.default(e,this.getConfig()),this.chart.render()}},{key:"getConfig",value:function(){var e=this.props,t=e.type,r=e.height,n=e.width,o=e.series,e=e.options;return this.extend(e,{chart:{type:t,height:r,width:n},series:o})}},{key:"isObject",value:function(e){return e&&"object"===(void 0===e?"undefined":_typeof(e))&&!Array.isArray(e)&&null!=e}},{key:"extend",value:function(t,r){var n=this,o=("function"!=typeof Object.assign&&(Object.assign=function(e){if(null==e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),r=1;r<arguments.length;r++){var n=arguments[r];if(null!=n)for(var o in n)n.hasOwnProperty(o)&&(t[o]=n[o])}return t}),Object.assign({},t));return this.isObject(t)&&this.isObject(r)&&Object.keys(r).forEach(function(e){n.isObject(r[e])&&e in t?o[e]=n.extend(t[e],r[e]):Object.assign(o,_defineProperty({},e,r[e]))}),o}},{key:"componentDidUpdate",value:function(e){if(!this.chart)return null;var t=this.props,r=t.options,n=t.series,o=t.height,t=t.width,i=JSON.stringify(e.options),a=JSON.stringify(e.series),r=JSON.stringify(r),s=JSON.stringify(n);i===r&&a===s&&o===e.height&&t===e.width||(a!==s&&i===r&&o===e.height&&t===e.width?this.chart.updateSeries(n):this.chart.updateOptions(this.getConfig()))}},{key:"componentWillUnmount",value:function(){this.chart&&"function"==typeof this.chart.destroy&&this.chart.destroy()}}]),r}();(exports.default=Charts).propTypes={type:_propTypes2.default.string.isRequired,width:_propTypes2.default.oneOfType([_propTypes2.default.string,_propTypes2.default.number]),height:_propTypes2.default.oneOfType([_propTypes2.default.string,_propTypes2.default.number]),series:_propTypes2.default.array.isRequired,options:_propTypes2.default.object.isRequired},Charts.defaultProps={type:"line",width:"100%",height:"auto"};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=Charts;var _react=require("react"),_apexcharts=_interopRequireDefault(require("apexcharts")),_propTypes=_interopRequireDefault(require("prop-types")),_excluded=["type","width","height","series","options"];function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _extends(){return(_extends=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r,n=arguments[t];for(r in n)!{}.hasOwnProperty.call(n,r)||(e[r]=n[r])}return e}).apply(null,arguments)}function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _objectWithoutProperties(e,t){if(null==e)return{};var r,n=_objectWithoutPropertiesLoose(e,t);if(Object.getOwnPropertySymbols)for(var o=Object.getOwnPropertySymbols(e),i=0;i<o.length;i++)r=o[i],t.includes(r)||{}.propertyIsEnumerable.call(e,r)&&(n[r]=e[r]);return n}function _objectWithoutPropertiesLoose(e,t){if(null==e)return{};var r,n={};for(r in e)if({}.hasOwnProperty.call(e,r)){if(t.includes(r))continue;n[r]=e[r]}return n}function ownKeys(t,e){var r,n=Object.keys(t);return Object.getOwnPropertySymbols&&(r=Object.getOwnPropertySymbols(t),e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)),n}function _objectSpread(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?ownKeys(Object(r),!0).forEach(function(e){_defineProperty(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function _defineProperty(e,t,r){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _toPropertyKey(e){e=_toPrimitive(e,"string");return"symbol"==_typeof(e)?e:e+""}function _toPrimitive(e,t){if("object"!=_typeof(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0===r)return("string"===t?String:Number)(e);r=r.call(e,t||"default");if("object"!=_typeof(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}function omit(e,t){var r=_objectSpread({},e);return t.forEach(function(e){delete r[e]}),r}function Charts(e){function o(e){return e&&"object"===_typeof(e)&&!Array.isArray(e)}var t=e.type,r=void 0===t?"line":t,t=e.width,i=void 0===t?"100%":t,t=e.height,u=void 0===t?"auto":t,p=e.series,c=e.options,t=_objectWithoutProperties(e,_excluded),n=(0,_react.useRef)(null),s=(0,_react.useRef)(null),f=((0,_react.useEffect)(function(){var e=n.current;return s.current=new _apexcharts.default(e,f()),s.current.render(),function(){s.current&&"function"==typeof s.current.destroy&&s.current.destroy()}},[]),(0,_react.useEffect)(function(){var e=JSON.stringify(s.current.options),t=JSON.stringify(s.current.series),r=JSON.stringify(c),n=JSON.stringify(p);e===r&&t===n&&u===s.current.height&&i===s.current.width||(t===n?s.current.updateOptions(f()):s.current.updateSeries(p))},[c,p,u,i]),function(){return a(c,{chart:{type:r,height:u,width:i},series:p})}),a=function(t,r){var n=_objectSpread({},t);return o(t)&&o(r)&&Object.keys(r).forEach(function(e){o(r[e])&&e in t?n[e]=a(t[e],r[e]):Object.assign(n,_defineProperty({},e,r[e]))}),n},e=omit(t,Object.keys(Charts.propTypes));return React.createElement("div",_extends({ref:n},e))}Charts.propTypes={type:_propTypes.default.string.isRequired,series:_propTypes.default.array.isRequired,options:_propTypes.default.object.isRequired,width:_propTypes.default.oneOfType([_propTypes.default.string,_propTypes.default.number]),height:_propTypes.default.oneOfType([_propTypes.default.string,_propTypes.default.number])};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-apexcharts",
3
- "version": "1.4.1",
3
+ "version": "1.4.2",
4
4
  "description": "React.js wrapper for ApexCharts",
5
5
  "main": "dist/react-apexcharts.min.js",
6
6
  "types": "types/react-apexcharts.d.ts",
@@ -33,29 +33,28 @@
33
33
  "react": ">=0.13"
34
34
  },
35
35
  "devDependencies": {
36
- "@types/react": "^16.8.8",
37
- "babel-core": "^6.26.3",
38
- "babel-plugin-transform-object-rest-spread": "^6.26.0",
39
- "babel-preset-env": "^1.7.0",
40
- "babel-preset-es2015": "^6.24.1",
41
- "babel-preset-react": "^6.24.1",
42
- "babel-preset-stage-3": "^6.24.1",
43
- "concurrently": "^4.1.0",
44
- "eslint": "^5.14.1",
45
- "eslint-plugin-react": "^7.12.4",
46
- "gulp": "^4.0.2",
47
- "gulp-babel": "^6.1.2",
36
+ "@babel/core": "^7.25.8",
37
+ "@babel/plugin-proposal-object-rest-spread": "^7.20.7",
38
+ "@babel/preset-env": "^7.25.8",
39
+ "@babel/preset-react": "^7.25.7",
40
+ "@rollup/plugin-babel": "^6.0.4",
41
+ "@rollup/plugin-node-resolve": "^15.3.0",
42
+ "@rollup/plugin-terser": "^0.4.4",
43
+ "@types/react": "^18.3.11",
44
+ "concurrently": "^9.0.1",
45
+ "eslint": "^9.12.0",
46
+ "eslint-plugin-react": "^7.37.1",
47
+ "gulp": "^5.0.0",
48
+ "gulp-babel": "^8.0.0",
48
49
  "gulp-concat": "^2.6.1",
49
- "gulp-react": "^3.1.0",
50
- "gulp-uglify": "^3.0.0",
51
- "jest": "^29.1.2",
52
- "react": "^16.6.3",
53
- "react-dom": "^16.6.3",
54
- "react-test-renderer": "^16.6.3",
55
- "rollup": "1.27.14",
56
- "rollup-plugin-babel": "^3.0.4",
57
- "rollup-plugin-node-resolve": "^3.4.0",
58
- "rollup-plugin-postcss": "^4.0.2",
59
- "rollup-plugin-uglify": "^3.0.0"
50
+ "gulp-react": "^4.0.0",
51
+ "gulp-uglify": "^3.0.2",
52
+ "jest": "^29.7.0",
53
+ "jest-environment-jsdom": "^29.7.0",
54
+ "react": "^18.3.1",
55
+ "react-dom": "^18.3.1",
56
+ "react-test-renderer": "^18.3.1",
57
+ "rollup": "4.24.0",
58
+ "rollup-plugin-postcss": "^4.0.2"
60
59
  }
61
60
  }