@vaadin/charts 23.2.9 → 23.2.11

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaadin/charts",
3
- "version": "23.2.9",
3
+ "version": "23.2.11",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -37,10 +37,10 @@
37
37
  ],
38
38
  "dependencies": {
39
39
  "@polymer/polymer": "^3.0.0",
40
- "@vaadin/component-base": "~23.2.9",
41
- "@vaadin/vaadin-lumo-styles": "~23.2.9",
42
- "@vaadin/vaadin-material-styles": "~23.2.9",
43
- "@vaadin/vaadin-themable-mixin": "~23.2.9",
40
+ "@vaadin/component-base": "~23.2.11",
41
+ "@vaadin/vaadin-lumo-styles": "~23.2.11",
42
+ "@vaadin/vaadin-material-styles": "~23.2.11",
43
+ "@vaadin/vaadin-themable-mixin": "~23.2.11",
44
44
  "highcharts": "9.2.2"
45
45
  },
46
46
  "devDependencies": {
@@ -52,5 +52,5 @@
52
52
  "web-types.json",
53
53
  "web-types.lit.json"
54
54
  ],
55
- "gitHead": "880679b5eca131e7fbd4f651726bea5abc270493"
55
+ "gitHead": "1f5ad874238211488c43bb1bd302975170d06b23"
56
56
  }
package/src/helpers.js ADDED
@@ -0,0 +1,24 @@
1
+ export function inflateFunctions(config) {
2
+ if (
3
+ // Check if param is a primitive/null/undefined value
4
+ !(config instanceof Object) ||
5
+ // Check if param is a plain object (not an array or HC object)
6
+ config.constructor !== Object
7
+ ) {
8
+ return;
9
+ }
10
+ Object.entries(config).forEach(([attr, targetProperty]) => {
11
+ if (attr.startsWith('_fn_') && (typeof targetProperty === 'string' || targetProperty instanceof String)) {
12
+ try {
13
+ // eslint-disable-next-line no-eval
14
+ config[attr.substr(4)] = eval(`(${targetProperty})`);
15
+ } catch (e) {
16
+ // eslint-disable-next-line no-eval
17
+ config[attr.substr(4)] = eval(`(function(){${targetProperty}})`);
18
+ }
19
+ delete config[attr];
20
+ } else if (targetProperty instanceof Object) {
21
+ inflateFunctions(targetProperty);
22
+ }
23
+ });
24
+ }
@@ -27,6 +27,7 @@ import Highcharts from 'highcharts/es-modules/masters/highstock.src.js';
27
27
  import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
28
28
  import { ResizeMixin } from '@vaadin/component-base/src/resize-mixin.js';
29
29
  import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
30
+ import { inflateFunctions } from './helpers.js';
30
31
  import { ChartSeries } from './vaadin-chart-series.js';
31
32
 
32
33
  /** @private */
@@ -272,6 +273,7 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
272
273
  static __callHighchartsFunction(functionName, redrawCharts, ...args) {
273
274
  const functionToCall = Highcharts[functionName];
274
275
  if (functionToCall && typeof functionToCall === 'function') {
276
+ args.forEach((arg) => inflateFunctions(arg));
275
277
  functionToCall.apply(this.configuration, args);
276
278
  if (redrawCharts) {
277
279
  Highcharts.charts.forEach((c) => c.redraw());
@@ -1148,7 +1150,7 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
1148
1150
  }
1149
1151
 
1150
1152
  const configCopy = deepMerge({}, jsonConfiguration);
1151
- this.__inflateFunctions(configCopy);
1153
+ inflateFunctions(configCopy);
1152
1154
  this._jsonConfigurationBuffer = this.__makeConfigurationBuffer(this._jsonConfigurationBuffer, configCopy);
1153
1155
 
1154
1156
  beforeNextRender(this, () => {
@@ -1214,24 +1216,6 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
1214
1216
  delete configuration[entry];
1215
1217
  }
1216
1218
 
1217
- /** @private */
1218
- __inflateFunctions(jsonConfiguration) {
1219
- Object.entries(jsonConfiguration).forEach(([attr, targetProperty]) => {
1220
- if (attr.startsWith('_fn_') && (typeof targetProperty === 'string' || targetProperty instanceof String)) {
1221
- try {
1222
- // eslint-disable-next-line no-eval
1223
- jsonConfiguration[attr.substr(4)] = eval(`(${targetProperty})`);
1224
- } catch (e) {
1225
- // eslint-disable-next-line no-eval
1226
- jsonConfiguration[attr.substr(4)] = eval(`(function(){${targetProperty}})`);
1227
- }
1228
- delete jsonConfiguration[attr];
1229
- } else if (targetProperty instanceof Object) {
1230
- this.__inflateFunctions(targetProperty);
1231
- }
1232
- });
1233
- }
1234
-
1235
1219
  /** @private */
1236
1220
  __initEventsListeners(configuration) {
1237
1221
  this.__initChartEventsListeners(configuration);
@@ -1684,6 +1668,7 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
1684
1668
  if (this.configuration) {
1685
1669
  const functionToCall = this.configuration[functionName];
1686
1670
  if (functionToCall && typeof functionToCall === 'function') {
1671
+ args.forEach((arg) => inflateFunctions(arg));
1687
1672
  functionToCall.apply(this.configuration, args);
1688
1673
  }
1689
1674
  }
@@ -1695,6 +1680,7 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
1695
1680
  const series = this.configuration.series[seriesIndex];
1696
1681
  const functionToCall = series[functionName];
1697
1682
  if (functionToCall && typeof functionToCall === 'function') {
1683
+ args.forEach((arg) => inflateFunctions(arg));
1698
1684
  functionToCall.apply(series, args);
1699
1685
  }
1700
1686
  }
@@ -1731,6 +1717,7 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
1731
1717
  const axis = axes[axisIndex];
1732
1718
  const functionToCall = axis[functionName];
1733
1719
  if (functionToCall && typeof functionToCall === 'function') {
1720
+ args.forEach((arg) => inflateFunctions(arg));
1734
1721
  functionToCall.apply(axis, args);
1735
1722
  }
1736
1723
  }
package/web-types.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/charts",
4
- "version": "23.2.9",
4
+ "version": "23.2.11",
5
5
  "description-markup": "markdown",
6
6
  "contributions": {
7
7
  "html": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/charts",
4
- "version": "23.2.9",
4
+ "version": "23.2.11",
5
5
  "description-markup": "markdown",
6
6
  "framework": "lit",
7
7
  "framework-config": {